Just starting WX Python extensions ...

NEWBIE ALERT!

Esteemed List Participants and Lurkers:

Thanks for the gracious response to my last NON-WX plea for help. I have
had lots of fun writing a successful beginner's tutorial example with
"time()". Special thanks to Bjoern Platzen for his "mentor" explanation.

Let me cut to the chase with the next question ... WX this time?
(System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
         wxPythonWIN32-2.4.1.2-Py22.exe)

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.

Here is everything but the popups:

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

   # Import and set up the 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 WX pieces.

I already have a filter written 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

<imadept@pa.net> wrote in message
news:3.0.5.32.20030801214226.007ea2c0@mail.pa.net...

NEWBIE ALERT!

Esteemed List Participants and Lurkers:

Thanks for the gracious response to my last NON-WX plea for help. I

have

had lots of fun writing a successful beginner's tutorial example with
"time()". Special thanks to Bjoern Platzen for his "mentor"

explanation.

Let me cut to the chase with the next question ... WX this time?
(System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
         wxPythonWIN32-2.4.1.2-Py22.exe)

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 think wxPython works the way you seem to expect it to - though I
suppose you could force it to work somewhat that way. You should really
think of it more like VB: event-driven forms, etc., than as something to
popup an occasional messagebox or inputbox. The EasyGUI module sounds
like it might be better suited for what you are describing (which sounds
more like a traditional, linear application, but with popup windows for
user interaction instead of console-mode).

Also, you should note that sometimes different frameworks (e.g.
wxPython) may not always behave properly when running inside a GUI
written in another framework (e.g. tkinter (used by IDLE)). Finally, if
you do decide to use wxPython, I would second Kevin's recommendation of
using the demo as a source of sample code. There should have been a
"Run the wxPython DEMO" icon created when you installed the package. If
that doesn't run, then you've got Python or wxPython install problems.
There are samples of the types of dialogs you describe in the Common
Dialogs section.

···

--
Greg

(From Art:)

I'll probably drop out of WX, since I don't fit very well with it.

I'll

look up "EasyGUI" as you have suggested and see what it does for me.

All

this makes me appreciate LabWindows-CVI all the more, except for the

$1000

price tag! I used it a lot in a previous job, and it did a good job

of

integrating linear programming with the event driven windows

environment.

I don't know about LabWindows, maybe someone else can help you there.
Coming from VB, I can say that Python w/ wxPython, even with wxGlade or
Boa Constructor is definitely more work than VB is/was. If you are
looking for something that is event-driven, then I'd suggest PythonCard.
I think that it would probably provide you the most productivity without
having to dig into as much lower level stuff. Otherwise, EasyGUI will
have the lowest learning curve (but much less capability too). Good
luck,

···

--
Greg

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

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

import wx

app = wx.PySimpleApp()

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

dlg = wx.MessageDialog(None, strMess1,
                      strTitle1,
                      wx.YES_NO | wx.ICON_INFORMATION)
boolVar = dlg.ShowModal() == wx.ID_YES
dlg.Destroy()

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

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

dlg = wx.MessageDialog(None, strResponse,
                      strTitle2,
                      wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()

print "End of Program"

Regards,
Cliff

···

On Fri, 2003-08-01 at 18:42, imadept@pa.net wrote:

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.

--
Someone shot nostalgia in the back
Someone shot our innocence
                          -Bauhaus

Cliff Wells wrote:

> I want to edit and run a SIMPLE beginner's program from the IDLE GUI.

NOTE: Cliff's example is excelent, but probably will NOT run from IDLE.
run it from the command line, or look into Boa

I find a decent editor and the command line is the way to go...

···

On Fri, 2003-08-01 at 18:42, imadept@pa.net wrote:

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

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

import wx

app = wx.PySimpleApp()

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

dlg = wx.MessageDialog(None, strMess1,
                      strTitle1,
                      wx.YES_NO | wx.ICON_INFORMATION)
boolVar = dlg.ShowModal() == wx.ID_YES
dlg.Destroy()

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

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

dlg = wx.MessageDialog(None, strResponse,
                      strTitle2,
                      wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()

print "End of Program"

Regards,
Cliff

--
Someone shot nostalgia in the back
Someone shot our innocence
                          -Bauhaus

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

From: Chris Barker

Cliff Wells wrote:

>
> > I want to edit and run a SIMPLE beginner's program from the IDLE GUI.

NOTE: Cliff's example is excelent, but probably will NOT run from IDLE.
run it from the command line, or look into Boa

I find a decent editor and the command line is the way to go...

I was going to say that it probably does work just fine with IDLE in Python
2.3 since IDLE (formerly IDLEfork) uses an external process to run scripts.

However, after just trying some samples, the result is not very satisfying.
I guess people just didn't do much testing with wxPython prior to the 2.3
release or perhaps the problem is specific to my Win2K setup?! Anyway, the
wxPython scripts I tested ran, but there was also an unexpected crash from
pythonw.exe on some related process. I am running ZoneAlarm (personal
firewall) but since I gave permission for the process to act as a server I
don't see why that would cause a crash.

<shameless plug>
The PythonCard codeEditor runs scripts externally, so it can also be used to
edit/run GUI scripts and it has the PyCrust shell built-in.
  codeEditor tool
  PythonCard Documentation: The Shell
</shameless plug>

ka

···

> On Fri, 2003-08-01 at 18:42, imadept@pa.net wrote: