python - Tuple returning numeric value if no getter used -


let me first figured out how fix this, i'm unsure underlying cause.

i wrote simple gps tagger uses tkinter accept various inputs, optionally gets gps coordinates via pynmea2, , outputs every filled field csv file. user can clear input fields move onto next point.

i realized yesterday while using 1 specific field incrementing one, made sense me include option have auto-increment it. used tk.checkbutton so.

the field names used internally , in csv file stored tuple, e.g.

fields = 'gs_rated_input_voltage', ... 'gs_equipment_location' 

upon being commanded save current inputs, loop iterates on filled text boxes, , returns them out of function. entries stored list in function, , return type isn't declared different, i'm assuming tuple contents being stored in list.

when commanded clear inputs, if specific field filled , checkbox checked, value stored , sliced:

text = entry[1].get() mod_text = str(text) last_int = int(mod_text[-1:]) mod_text = mod_text[:-1] + str(last_int + 1) entry[1].delete(0, tk.end) entry[1].insert(0, mod_text) 

the entries contain numbers, letters, , hyphens, last character reliably number - works, aside if has better way i'm ears.

all say, found out if didn't include .get() on first line, text set .58366352.58366416 every time, regardless of whatever inputted - numbers, letters, mix, etc.

can explain i'm missing here?

assuming entry list of tkinter.entry widgets, think doing when following:

text = entry[1] mod_text = str(text) 

so entry[1] widget. when call str() on object, request string representation. there nothing gurantee entry’s content here.

instead, path widget. path description widget lives within tkinter frame. combination of names in hiearchy down widget’s master, separated dot.

so value .58366352.58366416 means name of widget 58366416, , exists within different widget name 58366352 has root (which has no name) parent.

but in order actual text entry widget, have call entry.get().


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -