473,395 Members | 1,679 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,395 software developers and data experts.

Python equivilant to msgbox()

Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I would like to call this instead of print (to the screen) . I would like to write a simple script that is not an event drive gui but calls input boxes, message boxes, or maybe even a file open browser box as well?
Feb 13 '06 #1
13 15281
LittlePython wrote:
Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
would like to call this instead of print (to the screen) . I would like
to write a simple script that is not an event drive gui but calls input
boxes, message boxes, or maybe even a file open browser box as well?


Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent
Feb 13 '06 #2
That is exactly what I was look for .. thx
"Kent Johnson" <ke**@kentsjohnson.com> wrote in message
news:43**********@newspeer2.tds.net...
LittlePython wrote:
Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
would like to call this instead of print (to the screen) . I would like
to write a simple script that is not an event drive gui but calls input
boxes, message boxes, or maybe even a file open browser box as well?


Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent

Feb 13 '06 #3
Kent Johnson wrote:
LittlePython wrote:
Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
would like to call this instead of print (to the screen) . I would like
to write a simple script that is not an event drive gui but calls input
boxes, message boxes, or maybe even a file open browser box as well?


Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent

It's also possible to something like that with wxPython. Try:
import wx
app = wx.PySimpleApp()
dlg = wx.TextEntryDialog(None, 'Enter value', 'Title', '')
if dlg.ShowModal() == wx.ID_OK:
val = dlg.GetValue() # this line should be indented
dlg.Destroy()
print "you have entered %s" % val

Feb 13 '06 #4
On 12 Feb 2006 17:27:56 -0800, André <an***********@gmail.com> wrote:
It's also possible to something like that with wxPython. Try:
import wx
app = wx.PySimpleApp()
dlg = wx.TextEntryDialog(None, 'Enter value', 'Title', '')
if dlg.ShowModal() == wx.ID_OK:
val = dlg.GetValue() # this line should be indented
dlg.Destroy()
print "you have entered %s" % val


That's the sort of butt-ugly code that got me convinced that Dabo is
the way to go. To get a simple message box, you have to create it,
show it, check a return value against an ugly constant (make sure you
don't forget an use wx.OK instead!), and then remember to destroy it
or your app will hang.

The same code in Dabo is:

val = dabo.ui.getString("Enter value", "Some Title")
if val in None:
print "You canceled"
else:
print "You entered %s" % val

Look at both examples, and tell me which looks more Pythonic to you.

--

# p.d.
Feb 13 '06 #5
Peter Decker wrote:
It's also possible to something like that with wxPython. Try:
import wx
app = wx.PySimpleApp()
dlg = wx.TextEntryDialog(None, 'Enter value', 'Title', '')
if dlg.ShowModal() == wx.ID_OK:
val = dlg.GetValue() # this line should be indented
dlg.Destroy()
print "you have entered %s" % val


That's the sort of butt-ugly code that got me convinced that Dabo is
the way to go. To get a simple message box, you have to create it,
show it, check a return value against an ugly constant (make sure you
don't forget an use wx.OK instead!), and then remember to destroy it
or your app will hang.


if you're using a Python version without a "def" statement, it's time to upgrade.

</F>

Feb 13 '06 #6
On 2/13/06, Peter Decker <py******@gmail.com> wrote:
On 12 Feb 2006 17:27:56 -0800, André <an***********@gmail.com> wrote:
It's also possible to something like that with wxPython. Try:
import wx
app = wx.PySimpleApp()
dlg = wx.TextEntryDialog(None, 'Enter value', 'Title', '')
if dlg.ShowModal() == wx.ID_OK:
val = dlg.GetValue() # this line should be indented
dlg.Destroy()
print "you have entered %s" % val


That's the sort of butt-ugly code that got me convinced that Dabo is
the way to go. To get a simple message box, you have to create it,
show it, check a return value against an ugly constant (make sure you
don't forget an use wx.OK instead!), and then remember to destroy it
or your app will hang.

The same code in Dabo is:

val = dabo.ui.getString("Enter value", "Some Title")
if val in None:
print "You canceled"
else:
print "You entered %s" % val

Look at both examples, and tell me which looks more Pythonic to you.


While I agree that dabo's version is more Pythonic than wxPython, my
understanding is that dabo is built on top of wxPython. There are
other framework (wax, anygui) that also aim to make the coding "more
pythonic", hiding "ugly" wxPython details. Personnally, I am hesitant
to start using an extra layer on top of wxPython, with no guarantee
that it will be always updated. Ideally, something like dabo+wxPython
would become part of the standard Python distribution.

The original post was asking if it was possible to have such message
dialogs using Python, without having a full gui app. I'd say that the
answer is yes... and that one has a lot of options, depending on how
many packages one is ready to download.

André
Feb 13 '06 #7
On 2/13/06, Andre Roberge <an***********@gmail.com> wrote:
While I agree that dabo's version is more Pythonic than wxPython, my
understanding is that dabo is built on top of wxPython.
Yes. You get all the power of wxPython without having to deal with the
C++ style of coding.
There are
other framework (wax, anygui) that also aim to make the coding "more
pythonic", hiding "ugly" wxPython details. Personnally, I am hesitant
to start using an extra layer on top of wxPython, with no guarantee
that it will be always updated. Ideally, something like dabo+wxPython
would become part of the standard Python distribution.
I think the chances of Dabo not getting updated are about the same as
wxPython not getting updated. The authors have been highly active and
involved for a few years now, unlike Wax or anygui. Bugs get fixed in
hours usually, and enhancements to the tools are always being
released.

It would be way cool if the Powers that Be would adopt Dabo/wxPython
as part of the language. The combination is so much more powerful and
much better looking than Tkinter.
The original post was asking if it was possible to have such message
dialogs using Python, without having a full gui app. I'd say that the
answer is yes... and that one has a lot of options, depending on how
many packages one is ready to download.


Oh, I understand your response. But I know that when people who are
familiar with Python first see wxPython code, their first reaction is
usually not positive. I was just trying to show that you can create
UIs easily and Pythonically.

--

# p.d.
Feb 13 '06 #8
LittlePython wrote:
That is exactly what I was look for .. thx Surprised to hear that.

As VisualBasic programmer I would expect you to have experience with
ActiveX on Windows, where the best way to go with Python is to reuse all
the ActiveX components and their known user interfaces (i.e. constants
to use as parameter and constants for interpretation of return values)
directly from within Python.

A message box goes e.g. this way:
import win32com.client
axWshShell = win32com.client.Dispatch("WScript.Shell")
axWshShell.Popup(u"(MsgText)This axWshShell.Popup closes itself

after 45 seconds", 45, u"(MsgTitle)Testing WScript.Shell object:", 1)

By the way: is there a ready for direct use timed self closing Ok/Cancel
message box in any of the proposed GUI packages?

Claudio

"Kent Johnson" <ke**@kentsjohnson.com> wrote in message
news:43**********@newspeer2.tds.net...
LittlePython wrote:
Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
would like to call this instead of print (to the screen) . I would like
to write a simple script that is not an event drive gui but calls input
boxes, message boxes, or maybe even a file open browser box as well?


Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent


Feb 13 '06 #9
Or just do the message box.
import CLR.System.Windows.Forms as Forms
Forms.MessageBox.Show("message goes here", "Window title goes here")


http://www.zope.org/Members/Brian/PythonNet/

In theory this will also work on a linux system with Mono installed

Feb 13 '06 #10
I am no VB programmer just dabble in vbscripting abit. The only one I am
aware of is the popup as self closing. I never thought of using com.

Do you know of any thing for a busy box in the same vain as easygui
"Claudio Grondi" <cl************@freenet.de> wrote in message
news:ds**********@newsreader3.netcologne.de...
LittlePython wrote:
That is exactly what I was look for .. thx

Surprised to hear that.

As VisualBasic programmer I would expect you to have experience with
ActiveX on Windows, where the best way to go with Python is to reuse all
the ActiveX components and their known user interfaces (i.e. constants
to use as parameter and constants for interpretation of return values)
directly from within Python.

A message box goes e.g. this way:
>>> import win32com.client
>>> axWshShell = win32com.client.Dispatch("WScript.Shell")
>>> axWshShell.Popup(u"(MsgText)This axWshShell.Popup closes itself

after 45 seconds", 45, u"(MsgTitle)Testing WScript.Shell object:", 1)

By the way: is there a ready for direct use timed self closing Ok/Cancel
message box in any of the proposed GUI packages?

Claudio


"Kent Johnson" <ke**@kentsjohnson.com> wrote in message
news:43**********@newspeer2.tds.net...
LittlePython wrote:

Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
would like to call this instead of print (to the screen) . I would like
to write a simple script that is not an event drive gui but calls input
boxes, message boxes, or maybe even a file open browser box as well?

Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent


Feb 15 '06 #11
LittlePython wrote:
I am no VB programmer just dabble in vbscripting abit. The only one I am
aware of is the popup as self closing. I never thought of using com. Ok, so my remarks about COM were not for you.
Do you know of any thing for a busy box in the same vain as easygui No, I don't, but it doesn't mean, that there is none considering myriads
of various available COM components. My idea was to make you aware, that
you can use your VB compiler for creating any ActiveX/COM components for
usage with Python the way I have described, but as you write it seems
not to be an option for you.

So I have to admit, that EasyGUI is in your case apparently
exactly what you was looking for ...


:-)

Claudio

"Claudio Grondi" <cl************@freenet.de> wrote in message
news:ds**********@newsreader3.netcologne.de...
LittlePython wrote:
That is exactly what I was look for .. thx


Surprised to hear that.

As VisualBasic programmer I would expect you to have experience with
ActiveX on Windows, where the best way to go with Python is to reuse all
the ActiveX components and their known user interfaces (i.e. constants
to use as parameter and constants for interpretation of return values)
directly from within Python.

A message box goes e.g. this way:
>>> import win32com.client
>>> axWshShell = win32com.client.Dispatch("WScript.Shell")
>>> axWshShell.Popup(u"(MsgText)This axWshShell.Popup closes itself

after 45 seconds", 45, u"(MsgTitle)Testing WScript.Shell object:", 1)

By the way: is there a ready for direct use timed self closing Ok/Cancel
message box in any of the proposed GUI packages?

Claudio

"Kent Johnson" <ke**@kentsjohnson.com> wrote in message
news:43**********@newspeer2.tds.net...
LittlePython wrote:
>Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I
>would like to call this instead of print (to the screen) . I would like
>to write a simple script that is not an event drive gui but calls input
>boxes, message boxes, or maybe even a file open browser box as well?

Take a look at EasyGUI:
http://www.ferg.org/easygui/

Kent


Feb 15 '06 #12
I am glad you did remind me of WScript.Shell ... I have to keep in mind
that most if not all of what I have been using in VBS is avail to me.
Thx

"Claudio Grondi" <cl************@freenet.de> wrote in message
news:ds*********@newsreader3.netcologne.de...
LittlePython wrote:
I am no VB programmer just dabble in vbscripting abit. The only one I am
aware of is the popup as self closing. I never thought of using com.

Ok, so my remarks about COM were not for you.

Do you know of any thing for a busy box in the same vain as easygui

No, I don't, but it doesn't mean, that there is none considering myriads
of various available COM components. My idea was to make you aware, that
you can use your VB compiler for creating any ActiveX/COM components for
usage with Python the way I have described, but as you write it seems
not to be an option for you.

So I have to admit, that EasyGUI is in your case apparently
exactly what you was looking for ...


:-)

Claudio


"Claudio Grondi" <cl************@freenet.de> wrote in message
news:ds**********@newsreader3.netcologne.de...
LittlePython wrote:

That is exactly what I was look for .. thx

Surprised to hear that.

As VisualBasic programmer I would expect you to have experience with
ActiveX on Windows, where the best way to go with Python is to reuse all
the ActiveX components and their known user interfaces (i.e. constants
to use as parameter and constants for interpretation of return values)
directly from within Python.

A message box goes e.g. this way:

>>> import win32com.client
>>> axWshShell = win32com.client.Dispatch("WScript.Shell")
>>> axWshShell.Popup(u"(MsgText)This axWshShell.Popup closes itself
after 45 seconds", 45, u"(MsgTitle)Testing WScript.Shell object:", 1)

By the way: is there a ready for direct use timed self closing Ok/Cancel
message box in any of the proposed GUI packages?

Claudio
"Kent Johnson" <ke**@kentsjohnson.com> wrote in message
news:43**********@newspeer2.tds.net...
>LittlePython wrote:
>
>
>>Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I>>would like to call this instead of print (to the screen) . I would like>>to write a simple script that is not an event drive gui but calls input>>boxes, message boxes, or maybe even a file open browser box as well?
>
>Take a look at EasyGUI:
>http://www.ferg.org/easygui/
>
>Kent


Feb 15 '06 #13
LittlePython wrote:
I am glad you did remind me of WScript.Shell ... I have to keep in mind
that most if not all of what I have been using in VBS is avail to me.
Thx

Maybe in this context it could be also worth for you to know, that on
Windows you can use Python as a scripting language embedded in HTML
<script> blocks same way as you can use JScript and VBScript. This makes
the Internet browser a very good GUI alternative for anyone able to
write HTML code utilizing the appropriate scripting interface to the
interactive HTML page elements.

Claudio
Feb 15 '06 #14

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

Similar topics

1
by: Paul | last post by:
Hi I'm implementing a few COM classes using Python. I've come across a problem when I'm trying the return an instance of a class from a method on one of my classes. The code is as follows,...
2
by: marco | last post by:
Hi, first of all ; sorry for my poor english ; i'm french ... and i hope you can understand below I use python (and wxpython) on a win32 platform, to build a simple "home theater pc". I want...
0
by: justin worrall | last post by:
Hi,   I have a very simple python win32 example (gleaned from the O'Reilly book on Win32 programming for Python), of an Excel client with a COM server. Essentially I have three VB buttons -...
2
by: Kevin T. Ryan | last post by:
Hi Group - I have written a "semi-program" in MS Excel related to running a football pool. I've updated it over the past two years or so, to the point where it is getting pretty advanced. ...
9
by: StepH | last post by:
Hi, I'm not able to install BLT on my Python 2.4 (upgraded to 2.4.1) distibution... I'v try to download btlz-for-8.3.exe, but when i try to install it, i've a msgbox saying to the file is...
4
by: Jeff | last post by:
Hello all, I've created a COM dll for a number-crunching program. However when I tell the program what function to use from the DLL, it claims that it cant find the function. I have the...
63
by: Nick Palmer | last post by:
Hi all, Is there a DB2 equivilant to Oracle's DB Link functionality ? I have two DB2 databases and I need to get access to the tables in one from the other. In Oracle I would just create a DB...
6
by: Trint Smith | last post by:
This is how I did this sql server 2000 string in vb.net: "FROM TBL_TravelMain WHERE TravelMain_Mlv = '" & MLVTrimString & "'" In C# you can't use the & something &. How do I put this in C#,...
1
by: samanthavernon | last post by:
Hi All, I'm using Windows Vista with Python 2.5. I need the code to check for case sensitive letters and digits, but something isn't right with it. The code is below: # -*- coding: cp1252 -*-...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.