What's the difference?

S

SeeBelow

between this:

name = "C"

and this:

name = StringVar()
name.set("C")

I hope someone can explain that to me.

Thanks,

Mitchell Timin

--
"Many are stubborn in pursuit of the path they have chosen, few in
pursuit of the goal." - Friedrich Nietzsche

http://annevolve.sourceforge.net is what I'm into nowadays.
Humans may write to me at this address: zenguy at shaw dot ca
 
W

wes weston

between this:

name = "C"

and this:

name = StringVar()
name.set("C")

I hope someone can explain that to me.

Thanks,

Mitchell Timin

Mitchell,
>>> dir(Tkinter.StringVar) ['__del__', '__doc__', '__init__', '__module__', '__str__', '_default', 'get', 'set', 'trace', 'trace_variable', 'trace_vdelete', 'trace_vinfo']
>>> Tkinter.StringVar.__doc__ 'Value holder for strings variables.'
>>> dir("C")
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__',
'__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode',
'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex',
'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']wes
 
S

Shalabh Chaturvedi

between this:

name = "C"

and this:

name = StringVar()
name.set("C")

I hope someone can explain that to me.

I couldn't run your code.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'StringVar' is not defined

Where did you get StringVar from?
 
S

SeeBelow

between this:

name = "C"

and this:

name = StringVar()
name.set("C")

Now I realize that StringVar is a Tkinter class. You have to import
from Tkinter, and you have to execute Tk() before you can execute
StringVar().

There is more difference than similarity between my two fragments above.

Mitchell Timin

--
"Many are stubborn in pursuit of the path they have chosen, few in
pursuit of the goal." - Friedrich Nietzsche

http://annevolve.sourceforge.net is what I'm into nowadays.
Humans may write to me at this address: zenguy at shaw dot ca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top