Creating a Transparent Window in Python Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:39:00

1K+ Views

Python is the most popular language for developing and creating functional and desktop applications. It has a rich library of different modules and functions which provides extensibility and accessibility to create and develop applications.Tkinter is the most commonly used library for creating GUI-based applications. It has features like adding widgets and other necessary attributes.Let us suppose that we want to create a transparent window using tkinter. To create the transparent window, we can use the attributes property and define the opacity value.Example#Importing the tkinter library from tkinter import * #Create an instance of tkinter frame win= Tk() #Define ... Read More

Creating a Frameless Window in Python Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:37:48

4K+ Views

Tkinter is the most commonly used Python library for creating GUI-based applications. It has features like adding widgets and other necessary attributes.Let us suppose that we want to create a borderless window using tkinter. To create a borderless window, we can use the overrideredirect method which basically disables the window and removes the window element such as the closing button, title, minimization element and buttons, etc.overrideredirect is a Boolean function which can be either True or False. Once the window is opened, it can be closed by pressing Alt+F4.Example#Importing the tkinter library from tkinter import * #Create an instance ... Read More

Creating a Dropdown Menu Using Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:36:31

3K+ Views

Navigation is the most important part of any application, as it improves the user experience in an aesthetic way. Using Tkinter, we can create menus and submenus very efficiently.Tkinter has an inbuilt function to create menus and these can be invoked with another tkinter widget or window. Tkinter.Menu module provides some properties in Menu-items. Some of these properties are used to label the buttons, toggling the button, adding submenus using cascade properties, etc.In this article, we will see how to create a dropdown menu using tkinter.Menu and its Menu-item properties. We will use OptionMenu widget to create a list of ... Read More

Create a Date Picker Calendar in Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:34:21

3K+ Views

Tkinter is a popular Python library for creating and developing applications. It has various methods and functions that can be used for adding multiple features in an application.Tkcalendar is one of the tkinter packages that can be used to create GUI-based calendars in the window and thus, we can perform multiple operations like selecting the data, picking and scheduling the event through the calendar application and many more.However, in this article, we will see how we can create a Date Picker calendar using the Tkcalendar package. Before that, we have to install the package in our local environment using pip ... Read More

Changing the Mouse Cursor in Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:33:03

1K+ Views

Tkinter is a GUI-based Python library which is used to develop various types of functional and GUI-based applications. It provides lots of functions and methods that can be used to provide extensibility and various features while developing an application.In this article, we will see how we can change the mouse cursor while hovering on a button in the tkinter frame using the cursor property. There are plenty of cursor maps available in tkinter’s button library that provide different visuals for the end-user. Some of the cursor in the library are, "arrow""circle""clock""cross""dotbox""exchange""fleur""heart""heart""man""mouse""pirate""plus""shuttle""sizing""spider""spraycan""star""target""tcross""trek""watch"Let us first create some buttons and then we will ... Read More

Average Speed Calculator Using Tkinter

Dev Prakash Sharma
Updated on 04-Mar-2021 13:30:27

504 Views

In this article, we will see how to create a GUI-based application that will calculate the average speed. The average speed of a moving object can be calculated using the following formula, Average Speed = Distance / [Hours + (Minutes/60)]To select the input value, we will use the SpinBox method that is used to create a spinner for a range of values. These values are Distance (Kilometers), Hours, and Minutes.Examplefrom tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry and resize the frame win.geometry("700x400") win.resizable(0, 0) win.title("Average Speed Calculator") # Create Label ... Read More

Finding Mode in a Binary Search Tree in JavaScript

AmitDiwan
Updated on 04-Mar-2021 12:54:42

317 Views

Mode:Mode of a set of data is simply the number that occurs for most number of times in that set of data. For instance, 3 is the mode of dataset 2, 3, 1, 3, 4, 2, 3, 1 as it occurs for most number of times.Binary Search TreeA tree DS is a valid Binary Search Tree if it fulfils the following conditions −The left subtree of a node contains only nodes with keys less than or equal to the node's key.The right subtree of a node contains only nodes with keys greater than or equal to the node's key.Both the ... Read More

Traversing Diagonally in a Matrix in JavaScript

AmitDiwan
Updated on 04-Mar-2021 12:52:53

848 Views

Problem:We are required to write a JavaScript function that takes in a square matrix (an array of arrays having the same number of rows and columns). The function should traverse diagonally through that array of array and prepare a new array of elements placed in that order it encountered while traversing.For example, if the input to the function is −const arr = [    [1, 2, 3],    [4, 5, 6],    [7, 8, 9] ];Then the output should be −const output = [1, 2, 4, 7, 5, 3, 6, 8, 9];Example Live DemoThe code for this will be −const arr ... Read More

Ways to Get to a Specific Sum in JavaScript

AmitDiwan
Updated on 04-Mar-2021 12:51:08

137 Views

ProblemWe are required to write a JavaScript function that takes in an array of Integers, arr, as the first argument and a single integer, target, as the second argument.For each Integer in the array, our function can either assign ‘+’ or ‘-’ to it.Our function should find out how many ways in total exist to assign ‘+’, ‘-’ to make the sum of integers of the array equal to the target sum, target.For example, if the input to the function is −const arr = [1, 1, 1, 1, 1]; const target = 3;Then the output should be −const output = ... Read More

Finding Peculiar Pairs in Array in JavaScript

AmitDiwan
Updated on 04-Mar-2021 12:49:54

135 Views

ProblemWe are required to write a JavaScript function that takes in an array of Integers, arr, as the first and the only argument.Our function should count the occurrence of all such index pairs (i, j) that satisfy the following conditions −I < j, andarr[i] > 2 * arr[j]For example, if the input to the function is −const input = [2, 4, 3, 5, 1];Then the output should be −const output = 3;Output Explanation:Because the three desired pairs are −[4, 1], [3, 1] and [5, 1]ExampleThe code for this will be − Live Democonst arr = [2, 4, 3, 5, 1]; const ... Read More

Advertisements