0

I am currently working on a small application built with easygui consist with many boxes, on the main Window it has a 'Quit' button with will prompt a ccbox and ask if user decide to close the app or not. I wanted to link the 'X' button (throughout the application) to that box but seems the documentation didn't provide a clear instruction about what variables to put in cancel_choice. Can anyone enlighten me?

The Code I am using:

Choice = buttonbox(MainWinmsg, MainWintitle, MainWinchoice, cancel_choice=MainWinchoice[2])

right now the cancel_choice does not work as I am expected to be.

Easygui version is 0.98.1

Travis Su
  • 670
  • 2
  • 7
  • 17
  • @martineau at least don't downvote me? – Travis Su Dec 04 '17 at 00:03
  • @martineau I already done that, I just want to link that 'X' on other windows to that `ccbox()` – Travis Su Dec 04 '17 at 00:05
  • `easygui` itself doesn't have a "main window", so you must be creating one somewhere in your program. With the `buttonbox()` function now shown in your question, a single callback **function** via the `cancel_choice=` keyword argument can be provided. This function will get called—quoting from the source code— "if X or is pressed". So, to summarize, the "variable" you need to pass is the name of a function you want called when either of those two user events occur. You'll need to do something like `Choice = buttonbox(MainWinmsg, ..., cancel_choice=my_callback_function)`. – martineau Dec 04 '17 at 07:33

0 Answers0