tkinter

how to use loop to reduce the the code in python

*爱你&永不变心* 提交于 2021-02-11 12:26:15
问题 I would like to create a lot of widgets in tkinter. I am currently using a lot of code for this. Is there a way to summarise the code? However, I would still like to be able to capture the value of each widgets. The numbering goes up to 200... Thanks a lot! ''' self.A1_rubbing_marks_Type = tk.StringVar(self.A_Frame_measure) # Dictionary with options self.A1_choice_rubbing_marks= ['No', 'Yes'] self.A1_rubbing_marks_Type.set('') # set the default option self.A1_Menu_rubbing_marks = tk

Setting application-wide default fonts tkinter root window

ぃ、小莉子 提交于 2021-02-11 12:25:46
问题 I am trying to a create an optionDB file which should be of the type.Xdefaults in order to read into a Python Tkinter program to override the Windows system fonts. The idea was presented in the Tkinter book by Grayson on page 49. 1) Create a file called optionDB of type Xdefaults 2) type in the following code root = Tk() root.option_readfile('optionDB') At this point, a new font should override the system default. The optionDB file has the following line of code in it - *font: Verdana 10 I

Setting application-wide default fonts tkinter root window

依然范特西╮ 提交于 2021-02-11 12:25:16
问题 I am trying to a create an optionDB file which should be of the type.Xdefaults in order to read into a Python Tkinter program to override the Windows system fonts. The idea was presented in the Tkinter book by Grayson on page 49. 1) Create a file called optionDB of type Xdefaults 2) type in the following code root = Tk() root.option_readfile('optionDB') At this point, a new font should override the system default. The optionDB file has the following line of code in it - *font: Verdana 10 I

Place tkinter canvas shape onto cursor location

北城余情 提交于 2021-02-11 12:22:18
问题 I know there have been multiple posts similar to this but the problem I have is extremely unique. app = tk.TK() canvas = tk.Canvas(app, width = 600, height = 600) canvas.pack() ObjectR = canvas.create_rectangle(10, 200, 50, 200, tag = 'Cursor Location', fill = 'green') def keyinput(event): #e.x #e.y canvas.move(ObjectR, e.x, e.y) app.bind('<B1-Motion>', keyinput) app.mainloop() The above program creates a rectangle which then moves according to the pixel the mouse is over. The problem is that

Why is my treeview in the tkinter shows this?

时光毁灭记忆、已成空白 提交于 2021-02-11 12:13:10
问题 Currently the bug seems to be loosening it's position from my project. I have a last bug which I need to fix in order to complete my project. Code looks like this: c.execute("SELECT * FROM c20 WHERE Position = 'chain';") data1 = c.fetchall() c.execute("SELECT * FROM c20 WHERE Position = 'center';") data2 = c.fetchall() c.execute("SELECT * FROM c20 WHERE Position = 'Total';") data3 = c.fetchall() data1 = p_mod.list_multiply(data, int(copies_data)) data2 = p_mod.list_multiply(data2, int(copies

Tkinter - How to assign variable to currently selected item in Listbox?

霸气de小男生 提交于 2021-02-11 07:13:31
问题 I need help with a Python3.3 Tkinter scrollable list box that iterates through all the users installed fonts. The purpose of this function is to change the fonts in my Textfield in another part of my program.... from tkinter import * import tkinter.font def fontValue(): fontroot=Tk() fontroot.wm_title('FONTS') fonts=list(tkinter.font.families()) fonts.sort() fontbox = Listbox(fontroot,height=20) fontbox.pack(fill=BOTH, expand=YES, side=LEFT) scroll = Scrollbar(fontroot) scroll.pack(side=RIGHT

Tkinter - How to assign variable to currently selected item in Listbox?

霸气de小男生 提交于 2021-02-11 07:10:46
问题 I need help with a Python3.3 Tkinter scrollable list box that iterates through all the users installed fonts. The purpose of this function is to change the fonts in my Textfield in another part of my program.... from tkinter import * import tkinter.font def fontValue(): fontroot=Tk() fontroot.wm_title('FONTS') fonts=list(tkinter.font.families()) fonts.sort() fontbox = Listbox(fontroot,height=20) fontbox.pack(fill=BOTH, expand=YES, side=LEFT) scroll = Scrollbar(fontroot) scroll.pack(side=RIGHT

Python Tkinter :removing widgets that were created using a for loop

烈酒焚心 提交于 2021-02-11 07:09:49
问题 I'm currently learning how to use the Tkinter library on python to create a GUI that takes in longitude and latitude points and outputing that into a file. Basically I'm trying to automate the process of having to copy the correct format of line of points to another file. So I created a Entry and button field to see how many long/lat points are needed to generate a 'shape'. Using this integer input from user, I have a for loop to populate the GUI with multiple widgets asking for the long/lat

Python Tkinter :removing widgets that were created using a for loop

北城余情 提交于 2021-02-11 07:08:32
问题 I'm currently learning how to use the Tkinter library on python to create a GUI that takes in longitude and latitude points and outputing that into a file. Basically I'm trying to automate the process of having to copy the correct format of line of points to another file. So I created a Entry and button field to see how many long/lat points are needed to generate a 'shape'. Using this integer input from user, I have a for loop to populate the GUI with multiple widgets asking for the long/lat

Tkinter - How can I remove the background borders from ttk.Button?

时光怂恿深爱的人放手 提交于 2021-02-11 06:35:35
问题 by default, the buttons from ttk module, have a one pixel border. how can I delete this border? below an example code: from tkinter import * from tkinter import ttk root = Tk() root.geometry("400x300") style=ttk.Style() style.configure("TButton", padding=0, background="#ffffff") # I colored the background border white to see it in the window.. but, I don't want it, I want to delete the border! MyButton = ttk.Button(root, text="I have a white border.. how can I delet it?") MyButton.place(x=16,