tkinter

Tkinter GUI app runs slower as time goes on

你离开我真会死。 提交于 2021-01-05 04:47:53
问题 I am designing a GUI that shows the number of packets on a node at a given cycle. The program adds one to the counter every loop and updates the GUI with the new info, so that every ~0.1 seconds a different layout is drawn by the GUI. There are 7 different layouts, and when the program gets to layout 7 it goes back to 0, creating an infinite loop of the 7 layouts. This is intended. The problem is the program runs slower as time goes on, i.e. it takes about 0.101 seconds to increment from 0 to

Measure the height of a string in Tkinter Python?

你。 提交于 2021-01-02 17:20:29
问题 I need the height in pixel of a string in a Tkiner widget. It is the text in a row of a Listbox . I know I can measure the width of a string with tkinter.font.Font.measure . But how can I get the height? A similar question thematised only the width but not the height. 回答1: This would do the trick. tkinter.font.Font(font='TkDefaultFont').metrics('linespace') 回答2: tkf.Font(font=widget['font']).metrics('linespace') gives the height in pixels of a given widget's font: try: # In order to be able

Measure the height of a string in Tkinter Python?

二次信任 提交于 2021-01-02 17:16:07
问题 I need the height in pixel of a string in a Tkiner widget. It is the text in a row of a Listbox . I know I can measure the width of a string with tkinter.font.Font.measure . But how can I get the height? A similar question thematised only the width but not the height. 回答1: This would do the trick. tkinter.font.Font(font='TkDefaultFont').metrics('linespace') 回答2: tkf.Font(font=widget['font']).metrics('linespace') gives the height in pixels of a given widget's font: try: # In order to be able

Measure the height of a string in Tkinter Python?

谁都会走 提交于 2021-01-02 17:07:31
问题 I need the height in pixel of a string in a Tkiner widget. It is the text in a row of a Listbox . I know I can measure the width of a string with tkinter.font.Font.measure . But how can I get the height? A similar question thematised only the width but not the height. 回答1: This would do the trick. tkinter.font.Font(font='TkDefaultFont').metrics('linespace') 回答2: tkf.Font(font=widget['font']).metrics('linespace') gives the height in pixels of a given widget's font: try: # In order to be able

Python tkinter place put frame to the bottom

99封情书 提交于 2021-01-01 07:24:06
问题 I have this code class App(object): def __init__(self): self.root = Tk() self.root.attributes('-zoomed', True) f1 = Frame(self.root, bd=1, bg="green", relief=SUNKEN) f2 = Frame(self.root, bd=1, bg="red", relief=SUNKEN) f3 = Frame(self.root, bd=1, bg="blue", relief=SUNKEN) split = 0.5 f1.place(relx=0, relheight=1, relwidth=split) f2.place(relx=split, relheight=1, relwidth=1.0 - split) f3.place(height=50, width=self.screen_width) app = App() app.root.mainloop() and the output is this How to put

How to use tkinter tag_config? Python 3.7.3

梦想的初衷 提交于 2020-12-31 15:43:07
问题 So I wanted to make a text editor and I've gotten stuck on this part, I want it to change the color of a certain word thats typed in in real time, for example: Lets say I type print I want it to automatically change the foreground color from the default black color to lets say blue. I Don't really know if you have to use tag_configure to do this but if so can someone please help me work it, thanks. Code: from tkinter import * root = Tk() text = Text(root) text.grid(row=0) def Event(event):

How to use tkinter tag_config? Python 3.7.3

烈酒焚心 提交于 2020-12-31 15:42:49
问题 So I wanted to make a text editor and I've gotten stuck on this part, I want it to change the color of a certain word thats typed in in real time, for example: Lets say I type print I want it to automatically change the foreground color from the default black color to lets say blue. I Don't really know if you have to use tag_configure to do this but if so can someone please help me work it, thanks. Code: from tkinter import * root = Tk() text = Text(root) text.grid(row=0) def Event(event):

How to use tkinter tag_config? Python 3.7.3

删除回忆录丶 提交于 2020-12-31 15:41:46
问题 So I wanted to make a text editor and I've gotten stuck on this part, I want it to change the color of a certain word thats typed in in real time, for example: Lets say I type print I want it to automatically change the foreground color from the default black color to lets say blue. I Don't really know if you have to use tag_configure to do this but if so can someone please help me work it, thanks. Code: from tkinter import * root = Tk() text = Text(root) text.grid(row=0) def Event(event):

How to use tkinter tag_config? Python 3.7.3

╄→尐↘猪︶ㄣ 提交于 2020-12-31 15:28:29
问题 So I wanted to make a text editor and I've gotten stuck on this part, I want it to change the color of a certain word thats typed in in real time, for example: Lets say I type print I want it to automatically change the foreground color from the default black color to lets say blue. I Don't really know if you have to use tag_configure to do this but if so can someone please help me work it, thanks. Code: from tkinter import * root = Tk() text = Text(root) text.grid(row=0) def Event(event):

How to use tkinter tag_config? Python 3.7.3

空扰寡人 提交于 2020-12-31 15:27:53
问题 So I wanted to make a text editor and I've gotten stuck on this part, I want it to change the color of a certain word thats typed in in real time, for example: Lets say I type print I want it to automatically change the foreground color from the default black color to lets say blue. I Don't really know if you have to use tag_configure to do this but if so can someone please help me work it, thanks. Code: from tkinter import * root = Tk() text = Text(root) text.grid(row=0) def Event(event):