I am trying to create a GUI to receive text input from a user to define the number of cores to be used by a script. I am using the Entry
function, but would like to label this since there will be other text entries required. I have the following code, which worked for the OptionMenu
function, but I am not sure how to adapt it so that Entry
can receive the textvariable
option. I have written this as a function so it is possible to call it multiple times for different variables.
from Tkinter import *
root = Tk()
def UserInput(status,name):
optionFrame = Frame(root)
optionLabel = Label(optionFrame)
optionLabel["text"] = name
optionLabel.pack(side=LEFT)
var = StringVar(root)
var.set(status)
w = apply(Entry, (optionFrame, textvariable= var))
w.pack(side = LEFT)
optionFrame.pack()
cores = UserInput("1", "Number of cores to use for processing")
root.mainloop()