Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

tkinter - Get entry of python Combobox and convert to upper case

I built a program around two Comboboxes, where users can enter a number. The dropdown consists of the first column of the csv file below. After the user entered the number in the Combobox, I then take that number with .get() and search for it in the csv to get a related number to display in CB2. Both entries are then used to display pictures in a second GUI window. Because I only have upper case letters in the CSV's third column, I want to convert the second Combobox entries (by user) to upper case. Checking with print(), everything seems to work fine and the k and u are converted. However it doesn't seem to be found in the CSV anymore and therefor can't find the respective picture path.

Here's the code:

eingabe_index = str(eingabefeld_index.get())
eingabe_index = str(eingabe_index.upper())
print(eingabe_index)
motorttnr = [x[0] for x in daten]
index = [x[2] for x in daten]
filter_motorttnr = filter(lambda a: eingabe_motor in a, daten)
liste_filter_motorttnr = list(filter_motorttnr)
filter_index = filter(lambda a: eingabe_index in a, liste_filter_motorttnr)
liste_filter_index = list(filter_index)

I tried with and without forcing entry to string. What can I do to fix the issue?

Example of the CSV:

130822060;060_Motor.gif;1K1;5;060_Lage_1K1.gif;20;1K1_1_Kunststoffbox.gif 130822060;060_Motor.gif;U30;52;060_Lage_U30_Text.gif;780;1K1_Kunststoffbox_gruene_Stollen_Text.gif

130822061;061_Motor.gif;U30;52;061_Lage_U30_Text.gif;780;1K1_Kunststoffbox_gruene_Stollen_Text.gif

130822061;061_Motor.gif;1K1;52;061_Lage_1K1.gif;780;1K1_1_Kunststoffbox.gif

question from:https://stackoverflow.com/questions/65908374/get-entry-of-python-combobox-and-convert-to-upper-case

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...