
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 603 Articles for Tkinter

706 Views
The Text widget accepts multiline user input, where you can type text and perform operations like copying, pasting, and deleting. There are certain ways to disable the shortcuts for various operations on a Text widget.In order to disable copy, paste and backspace in a Text widget, you’ve to bind the event with an event handler and return break using lambda keyword in python. The following example demonstrates how it works.Example# Import the required library from tkinter import * # Create an instance of tkinter frame or widget win=Tk() win.geometry("700x350") # Create a text widget text=Text(win, font="Calibri, 14") text.pack(fill= ... Read More

11K+ Views
If you want to create a dropdown list of items and enable the items of list to be selected by the user, then you can use the Combobox widget. The Combobox widget allows you to create a dropdown list in which the list of items can be selected instantly. However, if you want to get the index of selected items in the combobox widget, then you can use the get() method. The get() method returns an integer of the selected item known as the index of the item.ExampleLet’s take an example to see how it works. In this example, we ... Read More

7K+ Views
There are various methods and built-in functions available with the messagebox library in tkinter. Let's assume you want to display a messagebox and take some input from the user in an Entry widget. In this case, you can use the askstring library from simpledialog. The askstring library creates a window that takes two arguments, the title of the window, and the input title before the Entry widget. Let's take an example to understand how it works.Example# Import the required library from tkinter import * from tkinter.simpledialog import askstring from tkinter.messagebox import showinfo # Create an instance of tkinter frame ... Read More

9K+ Views
When creating a graphical user interface (GUI) in Python with Tkinter, it's common to want to display data in a user-friendly format. One way to do this is to print a list of items to a Tkinter Text widget, which allows you to display the list with each item on a separate line. In this article, we'll cover how to print a list to a Tkinter Text widget and some tips for formatting the output. Creating a Tkinter Text Widget Before we can print a list to a Tkinter Text widget, we need to create the widget itself. Here's some ... Read More

4K+ Views
If you want to display a list of items that contains some columns in it, then you can use the Treeview widget in Tkinter. The Treeview widget allows the user to add a large number of lists along with the properties that can be customized instantly.If you want to attach a vertical scrollbar to the list of items in a Treeview widget, then you can define a constructor of Scrollbar and configure it by adding the command to it. Let’s take an example and see how it works.Example# Import the required libraries from tkinter import * from tkinter import ttk ... Read More

2K+ Views
The Treeview widget is used to display a list of items with more than one feature in the form of columns. By default, the listed items in a Treeview widget can be selected multiple times, however you can disable this feature by using selectmode="browse" in the Treeview widget constructor. The Treeview widget can be implemented by using the Treeview(root, column, **options) constructor.ExampleThe following example demonstrates how to disable multiselection in a Treeview widget.# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win=Tk() # Set the size of ... Read More

5K+ Views
The Combobox widget is one of the versatile widgets in tkinter that is used to create a dropdown list containing some values in it. You can select a value from the dropdown list that gets replaced by the default value of the combobox widget. You can create a combobox widget by initializing the constructor of Combobox(root, width, text) widget.Consider the case, if the user wants to clear the selected value from the combobox widget, the only way you can do so is to set the value of the combobox widget as NULL by using the set (' ') method. The ... Read More

860 Views
There are various built-in functions, widgets and methods available in the tkinter toolkit library which you can use to build robust and powerful desktop applications. The Button widget in tkinter helps users in creating buttons and performing different actions with the help of its functions. You can also bind the buttons to perform some specific events or callback by using the bind("button", callback) method.ExampleConsider the following example. to create a function that prints a message on the screen whenever the user presses the key. To bind the key with the function, you can use the bind("", callback) method.# ... Read More

5K+ Views
Tkinter offers many built-in functions and methods that contain several utility functions to help us construct a user-friendly application. In tkinter, if you want to open a webpage, you can use the built-in Python library, webview, which allows the users to view the HTML content in its own native GUI window. You can install the webview library by using the following command −pip install pywebviewTo create a window that will open the requested HTML content, you have to first create a window container by using the create_window(win_title, 'URL') method and specify the URL in the method. This will create a ... Read More

7K+ Views
In Tkinter, the toplevel widget is used to create a popup modal window. The popup window created by the toplevel window works similar to the default window of the tkinter application. It can have widgets such as text widget, button widget, canvas widget, frame, etc.The size and position of the toplevel window can be decided by making it flexible throughout the screen. In the toplevel window, all the widgets are always placed on top of the other windows.You can use root.winfo_x() and root.winfo_y() to get the position of the root window. Then, you can use the geometry method to position ... Read More