![]() ![]() The following program allows you to change the cursor by selecting it in a combobox: from tkinter import ttk Second, place it on the root window and expand it 100%.To change the cursor of the root window, you can: The cursor name can be one of the following values: Changing cursor for widgetsĪll ttk widgets have the cursor parameter that allows you to change the cursor when the mouse hovers them.įor example, if you want to change the cursor of a button, you can set the cursor name using the cursor parameter as follows: from tkinter import ttkīutton = ttk.Button(cursor=cursor_name) Code language: Python ( python ) In this example, the cursor changes to busy when the mouse is starting on the x-coordinates from 100 to 300. For example: import tkinter as tkĭef change_cursor (event): if event.x in range( 100, 300): If you want to change the cursor for an area of the root window, you can use the event and track the x (and/or y) coordinate of the cursor. Second, change the cursor to busy using the cursor parameter.First, set the width and height of the root windows to 300×300. ![]() Root.mainloop() Code language: Python ( python ) The following program shows how to change the cursor of the root window from normal to busy: import tkinter as tk The Normal cursor has the value of "" while the busy cursor has the value of "watch". Summary: in this tutorial, you’ll learn how to set the cursors for widgets in the Tkinter application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |