I am looking for the way I can use x value within Tkinter widget. I couldn't find an appropriate answer from the web. Any advice is appreciated. Thanks
regarding, confirm, it returns x and print(x) works.
from pyautogui import *
def test():
global x
x = confirm(buttons=['z2037', 'z2039'])
test()
print(x)
from pyautogui import *
from tkinter import *
root = Tk()
def test():
global x
x = confirm(buttons=['Z2 037', 'Z2 039'])
b = Button(root, text='KLO', padx=50, pady=50, command=test)
b.pack()
root.mainloop()
print(x)
If I add print(x) above root.mainloop(), Python throws an error, saying that name 'x' is not defined although it's global. If I add print(x) below root.mainloop(), it works.
But, I want to use x value(Z2 037, or Z2 039) inside tkinter widget. Is there any way to do that?