Closed Thread
Results 1 to 3 of 3

Thread: What is the value returned by a Dialog?

  1. #1
    xXZeroXx is offline Newbie
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    What is the value returned by a Dialog?

    Hello, this is my first post here, and I'm having some trouble with Python.
    I'm actually using wxPython the issue is, I've created a Dialog with wx.MessageDialog(....), and it displays and everything, i just don't know how to interact with it, I mean:

    -Dialog
    |Yes|No|

    If I click yes, it closes, if I click No it closes, how do I make those buttons actually do something?.
    I think what I'm looking for is some kind of return value so in that case I would be able to do:
    if dialog.returnValue == Ok:
    do this

    I've searched trough Google but I didn't find anything and wxpython wiki seems to be down.
    So.. any ideas?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2009
    Location
    Santa Clarita, CA
    Posts
    2,111
    Blog Entries
    47
    Rep Power
    31

    Re: What is the value returned by a Dialog?

    Without knowing wxPython I can't be sure, but I don't see why you can't just have this:
    Code:
    mdialog = wx.MessageDialog(None, "What's new with you?", wx.YES_NO | wx.ICON_QUESTION)
    retvalue = mdialog.ShowModal()
    I would think that the ShowModal function itself would return the value from the Dialog, since execution effectively stops there and waits for a user response. However, I have no way to know what ShowModal would return.

    Next time download the docs!
    Wow I changed my sig!

  4. #3
    xXZeroXx is offline Newbie
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Re: What is the value returned by a Dialog?

    Thanks for your answer, anyway, wxPython wiki is back online and I was able to solve the problem it was something like:
    Code:
    if Dialog.ShowModal() == wx.ID_YES:
                print "You pressed Yes"
            else:
                print "You pressed No"
    So thanks anyway
    BTW is there really some method to download documentation? because I've searched but didn't find anything.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 06-28-2011, 08:05 AM
  2. Replies: 1
    Last Post: 04-17-2011, 03:00 AM
  3. collect2: ld returned 1 exit status ERROR
    By Namesake in forum C and C++
    Replies: 5
    Last Post: 02-09-2010, 04:05 AM
  4. I've returned - CHILI5 READ THIS!!
    By Brandon W in forum The Lounge
    Replies: 22
    Last Post: 06-11-2009, 03:22 AM
  5. Print Dialog
    By Saint in forum C# Programming
    Replies: 2
    Last Post: 11-14-2006, 06:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts