Python & MessageBox OnAction()

This forum is currently in read-only mode.
From the Asset Store
6 JRPG Inspired Battle Tracks. Amp up your battles with these epic tracks!
  • Hi!

    I'm trying to use the MessageBox object in CC and evaluate some actions in Python. I've got it to display the message, but it fails to understand what option am I picking, no distinction between Yes / No etc. Any way to better handle this?

    Here's a bit of code:

    msgBox.SetButtons(2)
    msgBox.SetIcon(3)
    msgBox.MessageBox("Hey!", "Close this stuff?")
    if msgBox.OnYes():
        System.Close()
    else:
        sometext.Text = "You didn't close."

    Please help my guys, the frustration is killing me and my project. :P Any tips much appreciated.

  • The OnYes condition is a triggered event, which is only triggered in the event sheet and not in python. You'll have to either use just events or do it the way you'd have to do it without Construct in pure python by using a python library.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for a fast response! Oh... so it makes me wonder why have those Message Box options in the Python script editor at all. I know it's kind of an oddity, but it managed to confuse me and made me thing that it is functional, wasting a day of my life. Anyway, thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)