Found 26504 Articles for Server Side Programming

Adding a scrollbar to a group of widgets in Tkinter

Dev Prakash Sharma
Updated on 15-Apr-2021 13:08:31

724 Views

Let’s suppose you want to add a scrollbar to a group of widgets in an application, then you can use the Scrollbars property in tkinter. Adding Scrollbars to a group of widgets can be achieved by Scrollbar(....options).ExampleIn this example, we will define a group of Listbox widgets and then add a vertical scrollbar to make the list scrollable.#Import the required library from tkinter import * #Create an instance of tkinter frame or window win = Tk() #Define the geometry win.geometry("750x400") #Create a listbox listbox= Listbox(win) listbox.pack(side =LEFT, fill = BOTH) #Create a Scrollbar scrollbar = Scrollbar(win) ... Read More

How to use Boto3 to update the details of a workflow in AWS Glue Catalog

Ashish Anand
Updated on 15-Apr-2021 13:08:22

295 Views

In this article, we will see how to update the details of a workflow in AWS Glue Catalog.ExampleProblem Statement: Use boto3 library in Python to update details of a workflow that is created in your account.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: workflow_name is the required parameter for this function. Description and deault_run_properties are optional parameter. It updates the details of a given workflow.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass the region_name while ... Read More

How to use Boto3 to update the scheduler of a crawler in AWS Glue Data Catalog

Ashish Anand
Updated on 15-Apr-2021 13:08:00

411 Views

In this article, we will see how to update the scheduler of a crawler present in an AWS account.ExampleProblem Statement: Use boto3 library in Python to update the scheduler of a crawler.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: crawler_name and scheduler are the required parameters in this function.The format of scheduler should be as cron(cron_expression). Cron_Expression can be written as (15 12 * * ? *), i.e., the crawler will run every day at 12:15UTC.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. ... Read More

How to use Boto3 to remove tags from AWS Glue Resources

Ashish Anand
Updated on 15-Apr-2021 13:07:18

306 Views

In this article, we will see how to remove tags from AWS Glue Resources.ExampleRemove tags “glue-db: tests” in AWS glue database. Problem Statement: Use boto3 library in Python to remove tags in AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn and tags_list are the required parameters in this function.The format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idtags_list should be as [“key1, key2…]Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, ... Read More

How to use Boto3 to get tags from an AWS Glue Resources

Ashish Anand
Updated on 15-Apr-2021 13:06:58

1K+ Views

In this article, we will see how the users can get the tags associated in AWS Glue Resources.ExampleGet tags “glue-db: tests” from AWS glue database. Problem Statement: Use boto3 library in Python to get the tags from AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn is the required parameter in this function.Format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idStep 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass ... Read More

How to use Boto3 to add tags in AWS Glue Resources

Ashish Anand
Updated on 15-Apr-2021 13:06:39

1K+ Views

In this article, we will see how a user can add tags in AWS Glue Resources.ExampleAdd tags “glue-db: tests” in AWS glue database. Problem Statement: Use boto3 library in Python to add tags in AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn and tags_dict are the required parameters in this function.The format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idtags_dict should be as {“key”:”value”, ..}Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is ... Read More

Add advanced features to a tkinter Text widget

Dev Prakash Sharma
Updated on 15-Apr-2021 13:06:12

699 Views

Tkinter text widget is much more than just a multiline text editor. It is useful for many applications where user interaction is required.In order to configure the text widget, tkinter provides many functions and methods. Some of the features that we can add to style the text widgets are: changing the font-family, background-color, foreground-color, adding and selecting a particular text, changing font-size, and many more.ExampleIn this example, we will see how we can add different features to a particular text widget, #Import tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set ... Read More

Python Program to Create a Lap Timer

AmitDiwan
Updated on 15-Apr-2021 13:07:41

600 Views

When it is required to create a lap timer using Python, the ‘time’ method is used. The number of laps is predefined, and a try catch block is defined, to start the lap timer.Below is a demonstration of the same −Example Live Demoimport time start_time=time.time() end_time=start_time lap_num=1 print("Click on ENTER to count laps.Press CTRL+C to stop") try:    while True:       input()       time_laps=round((time.time() - end_time), 2)       tot_time=round((time.time() - start_time), 2)       print("Lap No. "+str(lap_num))       print("Total Time: "+str(tot_time))       print("Lap Time: ... Read More

Python program to find difference between current time and given time

AmitDiwan
Updated on 15-Apr-2021 13:06:06

397 Views

When it is required to find the difference between the current time and a given time, a method can be defined, that takes the hours, minutes, and seconds as parameter. It then calculates the difference between two given times.Below is a demonstration of the same −Example Live Demodef difference_time(h_1, m_1, h_2, m_2):    t_1 = h_1 * 60 + m_1    t_2 = h_2 * 60 + m_2    if (t_1 == t_2):       print("The times are the same")       return    else:       diff = t_2-t_1    hours = (int(diff / ... Read More

Find yesterday’s, today’s and tomorrow’s date in Python

AmitDiwan
Updated on 15-Apr-2021 13:05:43

463 Views

When it is required to find yesterday, today and tomorrow’s date with respect to current date, the current time is determined, and a method is used (in built) that helps find previous day and next day’s dates.Below is a demonstration of the same −Example Live Demofrom datetime import datetime, timedelta present = datetime.now() yesterday = present - timedelta(1) tomorrow = present + timedelta(1) print("Yesterday was :") print(yesterday.strftime('%d-%m-%Y')) print("Today is :") print(present.strftime('%d-%m-%Y')) print("Tomorrow would be :") print(tomorrow.strftime('%d-%m-%Y'))OutputYesterday was : 05-04-2021 Today is : 06-04-2021 Tomorrow would be : 07-04-2021ExplanationThe required packages are imported into the environment.The current date is determined ... Read More

Advertisements