vailixi Posted December 2, 2018 Share Posted December 2, 2018 I'm learning tkinter for python3. I'm trying to use a StringVar() from Entry (txtbox) txtvara = StringVar() c=Button(root) photo1=PhotoImage(file="/root/install.gif") c.config(image=photo1,width="100",height="30",activebackground="#f2f1f0",bg="#f2f1f0",command=sysinstall) c.place(x = 100,y = 92) e=Entry(root, width=12,textvariable=txtvara) e.place(x = 3, y = 92) I want to use the text in the system call but I can't even get it to print the variable to console. It just prints PY_VAR1 which I don't really understand. def sysinstall(): txtvarb = str(txtvara) print(txtvarb) Question: How do I convert StringVar() into string and use that to change label text in a system call? Quote Link to comment Share on other sites More sharing options...
vailixi Posted December 3, 2018 Author Share Posted December 3, 2018 I figured this. .get() will give you the text of the entry box so you can set that as a variable like so. package=e.get() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.