Moving a String to a StringVar

1314
2
07-28-2016 09:49 AM
PaulHacker2
New Contributor II

I am using the Entry Widget. In it I have:

global HoldString

HoldString = StringVar()

HoldString.set("")

Later I want the HoldString to have the value of a string that was made earlier like:

abc = "asdadad"

Trying

HoldString.set(abc)

just gives me a cryptic   PY_VAR0 when I try to print the value of HoldString

It seems I can only set it to a literal like HoldString("asdadad")

Is there anyway move the value of a string to a StringVar?

Thanks!

0 Kudos
2 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Paul

This doesn't appear to be directly a python problem... what are you using this in? perhaps a share there would be best.

PaulHacker2
New Contributor II

OK, here is the whole shebang. For ArcGIS I am making a GUI to do importing of layers.

The code uses ttk.Entry Widgets

monty.JPG

My program (Monty.py that is attached) uses Entry Widget to display the pathname to files (using tkFileDialog.askopenfilename)

But the Entry requires a textvariable being equal to a StringVar() and I cannot get the pathname I picked up to load the name.)

The black part of the JPG above is it printing what was displayed in the Entry box, but when it transferred the string to the StringVar for each of then it printed '<bound method StringVar.get of <Tkinter.StringVar instance...>>

The GeoScrip01 window is created by Monty.py for input of the two pathnames via two buttons, plus a Clear button, Submit Job button, and Quit.

It won't give me 'C:/Users/phacker/Documents/ArcGIS/FAKEINPUT/counties.txt'

I need that pathname (and others) to load GIS information later in the program.

Thanks,

Paul

0 Kudos