Jump to content

Recommended Posts

Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...