py tkinter Questions about the option box

dym7219 注册会员
2023-02-25 20:05

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > in your code, The output is always PY_VAR0 and PY_VAR1 because levelchoose and modechoose are both StringVar objects, and the default names of these objects are PY_VAR0 and PY_VAR1, so the output is the default names.
If you want to print the results selected in the radio box, you can modify the imp() function as follows:

def imp():
    print(levelchoose.get(), modechoose.get())

uses the get() method to get the value of the StringVar object, thus printing the selected difficulty and pattern.

About the Author

Question Info

Publish Time
2023-02-25 20:05
Update Time
2023-02-25 20:05

Related Question