Beginner's popups in vanilla Python program

Discussion in 'Python' started by Art, Aug 3, 2003.

  1. Art

    Art Guest

    NEWBIE ALERT!

    Esteemed List Participants and Lurkers:

    (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
    wxPythonWIN32-2.4.1.2-Py22.exe)

    I'm having a lot of fun getting started with Python ... it is the most
    elegant and graceful language I have ever used (Fortran, Cobol, Basic, many
    assemblers, Forth, C, VB, etc.). I don't have the resources or the
    research time to buy a stack of books, so I'm begging help here. Please be
    graciously patient.

    I want to edit and run a SIMPLE beginner's program from the IDLE GUI.
    Within the program, I want to pop up a Windows modal dialog box with a
    message "Is this a test?"; a title "Test Query"; and I want YES|NO buttons
    to exit and pass a yes|no boolean back to the program. The program will
    then pop up a second dialog message box "You selected (yes or no)" with
    title "Response:" with a close button. I don't really care if there is a
    "parent(?)" frame on the screen (but I prefer not) for the duration of the
    program, as long as it is terminated properly before the program ends.

    Here is everything but the popups:

    # Program: Beginners_Popups.py ... "Hello World" for popups

    # Import and set up the tk/WX/?? popups here.
    # As minimal as is possible

    print "Begin program"
    # Prepare the basic programmatic messages
    strMess1 = "Is this a Test?"
    strTitle1 = "Test Query"
    strResponse = "You selected "
    strTitle2 = "Response:"

    # 1st popup goes here:
    # Message = strMess1
    # Title = strTitle1
    # YES|NO buttons Returning Boolean boolVar

    # Build the appropriate response
    if boolVar:
    strResponse += "YES"
    else:
    strResponse += "NO"

    # 2nd popup goes here:
    # Message = strResponse
    # Title = strTitle2
    # and close button

    print "End of Program"


    Once I get this far, I will have the guts of everything I need (for now!).
    I just can't seem to find enough beginner's information for the simple
    popup pieces. I know I'm trying to incorporate Windows stuff in a DOS type
    environment, but I'm sure it can be done.

    I already have a filter written in Python to read and parse a directory of
    files into a dictionary of location #s and file names, read in a master
    location list, and create a text file of an HTML table with file links in
    the cells. I have about 120 locations to deal with, and it is working
    great. I just need a couple of primitive user interface points, and popups
    are standard.

    Thank you for your gracious comments, suggestions, assistance, and even
    criticisms.

    Blessings in abundance, all the best, and ENJOY!

    Art Du Rea Carlisle, PA
     
    Art, Aug 3, 2003
    #1
    1. Advertising

  2. Art

    Greg Brunet Guest

    I responded in a bit more detail in the wxPython newsgroup/list, but it
    seems that EasyGUI would be the best interface for you to use (compared
    to something like wxPython), since you seem to be thinking/designing in
    linear, traditional terms instead of event-driven. You should be able
    to find it with a Google search. Also, there are lots of on-line docs &
    tutorials, so you should be able to get by without buying books for a
    while at least.

    --
    Greg

    "Art" <> wrote in message
    news:...
    > NEWBIE ALERT!
    >
    > Esteemed List Participants and Lurkers:
    >
    > (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
    > wxPythonWIN32-2.4.1.2-Py22.exe)
    >
    > I'm having a lot of fun getting started with Python ... it is the most
    > elegant and graceful language I have ever used (Fortran, Cobol, Basic,

    many
    > assemblers, Forth, C, VB, etc.). I don't have the resources or the
    > research time to buy a stack of books, so I'm begging help here.

    Please be
    > graciously patient.
    >
    > I want to edit and run a SIMPLE beginner's program from the IDLE GUI.
    > Within the program, I want to pop up a Windows modal dialog box with a
    > message "Is this a test?"; a title "Test Query"; and I want YES|NO

    buttons
    > to exit and pass a yes|no boolean back to the program. The program

    will
    > then pop up a second dialog message box "You selected (yes or no)"

    with
    > title "Response:" with a close button. I don't really care if there

    is a
    > "parent(?)" frame on the screen (but I prefer not) for the duration of

    the
    > program, as long as it is terminated properly before the program ends.
    >
    > Here is everything but the popups:
    >
    > # Program: Beginners_Popups.py ... "Hello World" for popups
    >
    > # Import and set up the tk/WX/?? popups here.
    > # As minimal as is possible
    >
    > print "Begin program"
    > # Prepare the basic programmatic messages
    > strMess1 = "Is this a Test?"
    > strTitle1 = "Test Query"
    > strResponse = "You selected "
    > strTitle2 = "Response:"
    >
    > # 1st popup goes here:
    > # Message = strMess1
    > # Title = strTitle1
    > # YES|NO buttons Returning Boolean boolVar
    >
    > # Build the appropriate response
    > if boolVar:
    > strResponse += "YES"
    > else:
    > strResponse += "NO"
    >
    > # 2nd popup goes here:
    > # Message = strResponse
    > # Title = strTitle2
    > # and close button
    >
    > print "End of Program"
    >
    >
    > Once I get this far, I will have the guts of everything I need (for

    now!).
    > I just can't seem to find enough beginner's information for the simple
    > popup pieces. I know I'm trying to incorporate Windows stuff in a DOS

    type
    > environment, but I'm sure it can be done.
    >
    > I already have a filter written in Python to read and parse a

    directory of
    > files into a dictionary of location #s and file names, read in a

    master
    > location list, and create a text file of an HTML table with file links

    in
    > the cells. I have about 120 locations to deal with, and it is working
    > great. I just need a couple of primitive user interface points, and

    popups
    > are standard.
    >
    > Thank you for your gracious comments, suggestions, assistance, and

    even
    > criticisms.
    >
    > Blessings in abundance, all the best, and ENJOY!
    >
    > Art Du Rea Carlisle, PA
    >
    >
     
    Greg Brunet, Aug 3, 2003
    #2
    1. Advertising

  3. Art <> wrote in message news:<>...
    > NEWBIE ALERT!
    > <snip>


    Does this help?

    >>> from tkMessageBox import askyesno
    >>> help(askyesno)

    Help on function askyesno in module __main__:

    askyesno(title=None, message=None, **options)
    Ask a question; return true if the answer is yes

    This is standard Tkinter, no need to dowload anything and
    plenty of available documentation. See for instance

    http://www.pythonware.com/library/tkinter/introduction/index.htm

    Michele
     
    Michele Simionato, Aug 3, 2003
    #3
  4. Art

    Art Guest

    Stephan ...

    Thank you immensely for recommending "EasyGUI". That is EXACTLY what I was
    looking for. I did, of course, notice that you are the author! Where do I
    send the check?

    Anyone else looking for some simple popups ought to try EasyGUI ... it is a
    fantastic tool for getting ramped up in Python! It is a really nice
    compact collection of Message boxes and modal dialog popups to start off with.

    Blessings in abundance, all the best, and ENJOY!

    Art Du Rea, Carlisle, PA USA

    At 05:42 AM 8/4/03 -0700, Stephan Ferg wrote:
    >Look at EasyGui:
    >http://www.ferg.org/easygui/
    >
    >Here's what your program would look like:
    >==============================================================
    ># Program: Beginners_Popups.py ... "Hello World" for popups
    >from easygui import *
    >
    >print "Begin program"
    >
    ># Prepare the basic programmatic messages
    >strMess1 = "Is this a Test?"
    >strTitle1 = "Test Query"
    >strResponse = "You selected "
    >strTitle2 = "Response:"
    >
    >boolVar = boolbox(strMess1, strTitle1, ["Yes", "No"])
    >
    ># Build the appropriate response
    >if boolVar:
    > strResponse += "YES"
    >else:
    > strResponse += "NO"
    >
    >msgbox(strResponse, strTitle2) # button is OK
    >boolbox(strResponse, strTitle2, ["Close"]) # button is Close
    >print "End of Program"
    >--
     
    Art, Aug 5, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VisionSet

    Custom or vanilla Collection/Map?

    VisionSet, Sep 15, 2003, in forum: Java
    Replies:
    3
    Views:
    398
    Harald Hein
    Sep 15, 2003
  2. VisionSet
    Replies:
    1
    Views:
    341
    Roedy Green
    Jul 3, 2004
  3. Neil Benn

    Vanilla python path

    Neil Benn, Jul 25, 2005, in forum: Python
    Replies:
    0
    Views:
    360
    Neil Benn
    Jul 25, 2005
  4. markritter150

    Vanilla Ice is back!

    markritter150, Jun 3, 2008, in forum: C Programming
    Replies:
    6
    Views:
    328
  5. Moe Sisko
    Replies:
    1
    Views:
    884
    George
    Aug 4, 2008
Loading...

Share This Page