tkinter-layout

How to add hover feature for text description on a Tkinter button?

非 Y 不嫁゛ 提交于 2021-02-05 11:52:37
问题 I want to add a hover feature on a Tkinter button where if the user hovers the mouse cursor then description text displays. I also want to add some delay for that description to appear so that it would not be intrusive. I can try using the "<Enter>" and "<Leave>" binding of the button to a function and make some "Label" appear in some corner of the app. But this approach may not be the most elegant. 回答1: Here is a small snippet using Pmw (python mega widgets) for the tool tips. Firstly start

How to add hover feature for text description on a Tkinter button?

天大地大妈咪最大 提交于 2021-02-05 11:52:10
问题 I want to add a hover feature on a Tkinter button where if the user hovers the mouse cursor then description text displays. I also want to add some delay for that description to appear so that it would not be intrusive. I can try using the "<Enter>" and "<Leave>" binding of the button to a function and make some "Label" appear in some corner of the app. But this approach may not be the most elegant. 回答1: Here is a small snippet using Pmw (python mega widgets) for the tool tips. Firstly start

Different shapes of windows in tkinter

天大地大妈咪最大 提交于 2021-02-05 10:41:29
问题 normally when you make a window in tkinter using Tk(), the standard shape of the window would be a square. Is there any way we can make the shape anything else? 回答1: No, you cannot create windows of any shape other than a rectangle. 来源: https://stackoverflow.com/questions/64294866/different-shapes-of-windows-in-tkinter

how to get tab_id to set it as active tab

≡放荡痞女 提交于 2021-02-05 08:56:09
问题 I am trying to build a text editor using tkinter. i just wanted to set the focus in newly opened tab.By using a static tab_id i can set this for instant but if I have more than 15 tabs at a time it is difficult to find tab_id . i want tab_id with tab_name or tab_title or any other way Here is my code import tkinter as tk from tkinter import ttk, filedialog import os root = tk.Tk() root.title("Tab Widget") tabControl = ttk.Notebook(root) def open_file(event=None): file1 = filedialog

How to add a CV2 tracking bar in a tkinter window

蹲街弑〆低调 提交于 2021-01-29 11:16:07
问题 How to add a cv2 trackbar to a Tkinter window? I have 2 snippets of code that my teammates have made, but it is difficult to integrate them in the same window. I am able to use them in separate windows but I want to use them in the same window. CODE FOR THE VIDEO PLAYING IN TKINTER: import cv2 import tkinter as tk from tkinter import * # from tkinter import ttk # from ttk import Frame # import ImageTk white = "#ffffff" lightBlue2 = "#adc5ed" font = "Constantia" fontButtons = (font, 12)

Tkinter Button command getting executed before clicking the button [duplicate]

与世无争的帅哥 提交于 2021-01-19 08:38:13
问题 This question already has answers here : Why is Button parameter “command” executed when declared? (5 answers) Closed 2 years ago . I have created a frame, In that i have two browse button, i want browse two file that ending with ".txt" extension and printing it on screen. In my scenario, browse function getting called before pressing Button's on the frame. Am expecting it should called when i press Button. Complete code attached. Kindly someone correct me what i did wrong. from Tkinter

Tkinter Button command getting executed before clicking the button [duplicate]

一个人想着一个人 提交于 2021-01-19 08:37:43
问题 This question already has answers here : Why is Button parameter “command” executed when declared? (5 answers) Closed 2 years ago . I have created a frame, In that i have two browse button, i want browse two file that ending with ".txt" extension and printing it on screen. In my scenario, browse function getting called before pressing Button's on the frame. Am expecting it should called when i press Button. Complete code attached. Kindly someone correct me what i did wrong. from Tkinter

How to shrink a frame in tkinter after removing contents?

一个人想着一个人 提交于 2020-06-23 11:12:02
问题 Most of the topics I came across deals with how to not shrink the Frame with contents, but I'm interested in shrinking it back after the destruction of said contents. Here's an example: import tkinter as tk root = tk.Tk() lbl1 = tk.Label(root, text='Hello!') lbl1.pack() frm = tk.Frame(root, bg='black') frm.pack() lbl3 = tk.Label(root, text='Bye!') lbl3.pack() lbl2 = tk.Label(frm, text='My name is Foo') lbl2.pack() So far I should see this in my window: Hello! My name is Foo Bye! That's great,

How to shrink a frame in tkinter after removing contents?

落爺英雄遲暮 提交于 2020-06-23 11:12:01
问题 Most of the topics I came across deals with how to not shrink the Frame with contents, but I'm interested in shrinking it back after the destruction of said contents. Here's an example: import tkinter as tk root = tk.Tk() lbl1 = tk.Label(root, text='Hello!') lbl1.pack() frm = tk.Frame(root, bg='black') frm.pack() lbl3 = tk.Label(root, text='Bye!') lbl3.pack() lbl2 = tk.Label(frm, text='My name is Foo') lbl2.pack() So far I should see this in my window: Hello! My name is Foo Bye! That's great,

Tkinter configuration

Deadly 提交于 2020-06-01 04:48:25
问题 I'm super new to programming and I'm using pycharm as my IDE. import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter' Not sure why I get this error, I installed the Tk library as well and still get the error. I am using a Mac. 回答1: If you are using python3 please use import tkinter 回答2: Well,if you are using python 3.8,In the install Setup,it has this choice: If this couldn't solve your problem,Read the python official document