user interface - Python: Tkinter Entry widget is not working -


from tkinter import * root = tk() ticker1 = stringvar() ticker2 = stringvar() root.title("choose companies") label(root,           text = "company no. 1",           fg = "black",           font ="helvetica 16 italic").pack() name = entry(root,name = ticker1 ).pack() label(root,           text = "company no. 2",           fg = "black",           font ="helvetica 16 italic").pack() name1 = entry(root,name1 = ticker2).pack() root.mainloop() 

the code not work gives me error:

exceptions.typeerror: cannot concatenate 'str' , 'instance' objects

the format entry widget in python gui looks correct.
i'm using python 2.7 windows 8.1

the entry class constructor has no keyword parameter named name1, can pass stringvar instance textvariable keyword parameter , retrieve text calling get() method on stringvar instance. alternately, can call get() method on entry instance itself.

example:

var = stringvar() entry = entry(root, textvariable=var) entry.pack()  var.set('default value') input = var.get() 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -