tkinter-entry

How to return a value of a function given as a command in tkinter

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-05 08:23:29
问题 I've written a very simple code with python tkinter , it contains an input box. I'd like to keep the value inserted by the user to myself, in case I need to use it later. Here's the code: import tkinter as tk root=tk.Tk() root.geometry("600x400") def submit(): name=name_entry.get() return name name_label = tk.Label(root, text = 'Username', font=('calibre', 10, 'bold')) name_entry = tk.Entry(root, font=('calibre',10,'normal')) sub_btn=tk.Button(root,text = 'Submit', command = submit) name

How to return a value of a function given as a command in tkinter

断了今生、忘了曾经 提交于 2021-02-05 08:23:06
问题 I've written a very simple code with python tkinter , it contains an input box. I'd like to keep the value inserted by the user to myself, in case I need to use it later. Here's the code: import tkinter as tk root=tk.Tk() root.geometry("600x400") def submit(): name=name_entry.get() return name name_label = tk.Label(root, text = 'Username', font=('calibre', 10, 'bold')) name_entry = tk.Entry(root, font=('calibre',10,'normal')) sub_btn=tk.Button(root,text = 'Submit', command = submit) name

Concurrent.futures opens new windows in tkinter instead of running the function

心已入冬 提交于 2021-01-29 20:40:47
问题 I am trying to run a function concurrently over multiple files in a gui using tkinter and concurrent.futures Outside of the GUI, this script works fine. However, whenever I translate it over into the GUI script, instead of running the function in parallel, the script opens up 5 new gui tkinter windows (the number of windows it opens is equal to the number of processors I allow the program to use). Ive looked over the code thoroughly and just cant understand why it is opening new windows as

Using exec to define and get the value from variables raises NameError

自闭症网瘾萝莉.ら 提交于 2021-01-29 14:53:02
问题 Right now I'm working on a project that will ask for a runner's name, 1 mile, 2 mile, and 5 miles times and generate data based off that. The requirement is to have enough entries for 7 runners but I thought I'd add the ability to add any number of runners by using exec() . However, when trying to read data from the variables defined within them, I get a NameError: name 'entry2' is not defined but not for entry0 and entry1 , so I was wondering if anyone could help me out on these. In case it

how do I create entry fields and buttons to get the content from the entry field using iteration in tkinter for python?

为君一笑 提交于 2021-01-29 11:22:12
问题 I'm trying to make a tkinter GUI with a certain amount of buttons and entry fields that is specified by the user, so in this code below for example if the user specifies the variable number to be 3 I want there to be 3 entry boxes and , and I want to set it up so that if I type a value into the first field and click the button next to it, I want that button to read the value from the entry field next to it. I also need to assign each entry field to a variable that will be created through the

tkinter entry widget not updating

ぃ、小莉子 提交于 2021-01-29 06:31:41
问题 I've searched everywhere on the web but unfortunately no where did I find an answer to this question: after setting a tkinter Entry() widget's textvariable to a textvariable. the text variable does not update after I have typed text into the entry. code below: def saveFileName(self): if(self.save_file_name != ""): self.window.destroy() self.name_not_set = False print("saving...") else: print("notsaving...entry empty") pass def cancel(self): self.name_not_set = False self.exit = True self

How can I update Entry without a “submit” button in Tkinter?

混江龙づ霸主 提交于 2021-01-28 19:34:49
问题 So I have Entries which have some values assigned to them from a CFG File. I want to modify the CFG file when the Entry is updated, live, without a submit button; Using <Key> binding will work but will take only the previous value, not the current one, as the last key pressed is not taken into consideration as a value, but as a key-press . For example: class EntryBox: def __init__(self, value, option, section, grid_row, master_e): self.section = section self.option = option self.box = Entry

How I can solved this name is not defined

北城余情 提交于 2020-12-27 07:23:13
问题 I want to make the program that I made can run i make code like this def cafe_food(self): friedrice_items = tk.Entry(F_FItems) friedrice_items.config(width=7, borderwidth=4, relief="sunken", font=("calibri", 10,"bold"),foreground="white", background="#248aa2") friedrice_items.place(x=81, y=1) def Total_Biil(self): friedrice_price = 10 pizza_price = 20 if friedrice_items.get() != "": friedrice_cost = friedrice_price * int(friedrice_items.get()) else: friedrice_cost = 0 if pizza_items.get() !=