I am putting together a GUI for a customized calculator that automatically converts certain units of measurements into other units of measurement.
I want to return the actual text selected so I can write if statements from whatever the user selected. How do I get python to return the actual value instead of what I am getting now?
Whenever I test this code I receive the following:
VirtualEvent event x=0 y=0
Below is the portion of the code that I am attempting to use for this process. For the example code below I want the user to be able to input area as either acres or square feet. I then plan to write an if statement to convert whatever they selected into square kilometers (code for input of numbers not included in this example in an attempt to keep this post concise).
import tkinter as tk
from tkinter.ttk import *
master = tk.Tk()
master.title("Gas Calculator")
v = tk.IntVar()
combo = Combobox(master)
def callback(eventObject):
print(eventObject)
comboARU = Combobox(master)
comboARU['values']= ("Acres", "Ft^2")
comboARU.current(0) #set the selected item
comboARU.grid(row=3, column=2)
comboARU.bind("<<ComboboxSelected>>", callback)
master.mainloop()
Please let me know if I can expand on anything. I am still new at python so I wouldnt be surprised at all if this is just a simple syntax thing that I am missing.