473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Beginner's popups in vanilla Python program

Art
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
Jul 18 '05 #1
3 2846
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" <im*****@bigfoot.com> wrote in message
news:ma**********************************@python.o rg...
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


Jul 18 '05 #2
Art <im*****@bigfoot.com> wrote in message news:<ma**********************************@python. org>...
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/tk...tion/index.htm

Michele
Jul 18 '05 #3
Art
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"
--

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brad | last post by:
Hello. I know the basics of C++, but have a few questions. Is Visual C++ the same as C++? I'm very confused there. Also, the programs that I learned in my beginning programming class are all in...
52
by: Harlan Messinger | last post by:
Can you help me figure out what to do about popups? Sometimes we develop web applications where popups make very good sense for precisely the same reasons they make sense in traditional...
0
by: Neil Benn | last post by:
Hello, I'm attempting to determine what paths I would need on a win32, Linux, OSX box to run python. This should be a vanilla python with no extra packages (including tk). The paths I have...
2
by: John Salerno | last post by:
Ok, like I mentioned before, I'm learning C# for fun. I'm interested in learning Python sort of as a "supplement" (by that, I mean a language with scripting capabilities that can do things maybe...
18
by: mitchellpal | last post by:
Hi guys, am learning c as a beginner language and am finding it rough especially with pointers and data files. What do you think, am i being too pessimistic or thats how it happens for a beginner?...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
2
by: enquiring mind | last post by:
I read the posting by Rehceb Rotkiv and response but don't know if it relates to my problem in any way. I only want to write German to the screen/console for little German programs/exercises in...
0
by: Mufasa | last post by:
I've got a browser object I'm using in a windows program. If the page I'm going to have a popup, it causes a window to be opened. If the page is reloaded, the popup appears again. Same thing -...
2
by: CC | last post by:
Hi: http://web.newsguy.com/crcarl/python/hexl.py This is my first Python program other than tutorial code snippet experimentation. I chose a hex line editor. I may do a hex screen editor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.