simple GUI question

R

Roose

I have been writing only command line programs in python, and I need a way
to simply pop up a GUI dialog box, with an "OK" box. Simple huh?

I have used tkMessageBox.showwarning. This works OK but it also pops up an
empty frame -- i.e. it pops up 2 things. Is there a way to disable this, or
is there an alternate way of doing things? OK call me anal, but it bothers
me.

Another thing I would *like* but is not strictly necessary would be to
change the font size and color of the text within the box. Is there a good
way of doing that? I have googled around but can't find any decent example
code for some reason.

I can use Python 2.3 only, and only stuff that is included in the standard
install. For something so trivial I can't roll out a new version of Python
or any additional software.

So I assume Tkinter is pretty much my only option, or is that not the case?

Thanks for any help.

Roose
 
V

vincent wehren

Roose said:
I have been writing only command line programs in python, and I need a way
to simply pop up a GUI dialog box, with an "OK" box. Simple huh?

I have used tkMessageBox.showwarning. This works OK but it also pops up an
empty frame -- i.e. it pops up 2 things. Is there a way to disable this, or
is there an alternate way of doing things? OK call me anal, but it bothers
me.

You want somthing like:

root = Tkinter.Tk()
root.withdraw()
msg = tkMessageBox.showwarning("Ooops", "Some warning")


--
Vincent Wehren
Another thing I would *like* but is not strictly necessary would be to
change the font size and color of the text within the box. Is there a good
way of doing that?
I have googled around but can't find any decent example
 
R

Roose

You want somthing like:
root = Tkinter.Tk()
root.withdraw()
msg = tkMessageBox.showwarning("Ooops", "Some warning")

Awesome thanks! Any chance you know about the font thing : )

Nah I'll stop being lazy and hack it... but for some reason Tkinter doesn't
jive with the way I think at all. It seems very different from the rest of
Python, which makes sense obviously since it was around before Python...
 
B

Brian van den Broek

Roose said unto the world upon 2004-12-08 02:23:
Awesome thanks! Any chance you know about the font thing : )

Nah I'll stop being lazy and hack it... but for some reason Tkinter doesn't
jive with the way I think at all. It seems very different from the rest of
Python, which makes sense obviously since it was around before Python...

Hi,

I don't know Tkinter past a hour of playing, so I cannot show you how. I
can, however, show you a good place to start looking:
<http://www.google.com/search?num=50&hl=en&q=Tkinter+Python+font+widget&btnG=Search&meta=>

Best,

Brian vdB
 
B

Brian van den Broek

Brian van den Broek said unto the world upon 2004-12-08 03:16:

Hi,

I don't know Tkinter past a hour of playing, so I cannot show you how. I
can, however, show you a good place to start looking:
<http://www.google.com/search?num=50&hl=en&q=Tkinter+Python+font+widget&btnG=Search&meta=>


Best,

Brian vdB

Hi,

I didn't mean that in a grouchy way. I just took a quick look at some of
the links and
<http://www.cs.sfu.ca/CC/120/ggbaker/ref/tkinter/ar01s17.html> looked
promising.

Best,

Brian vdB
 
E

Eric Brunel

Roose wrote:
[snip]
Another thing I would *like* but is not strictly necessary would be to
change the font size and color of the text within the box. Is there a good
way of doing that? I have googled around but can't find any decent example
code for some reason.

Short answer: you can't. The tkMessageBox functions use "native" dialogs, which
cannot be configured.

The long answer depends on which platform you're on. If you are on Windows...,
see short answer ;-) : the dialogs used are actually the native ones, and apart
from abandonning the tkMessageBox module and designing your own dialogs, there
is no way to alter their appearence (not that I know of).

If you're on Unix, it's a bit better but not much: since there's no such thing
as "native" dialogs, the dialogs are actually tcl code that is in the tcl/tk
distro, that you can hack anyway you want. This is however not recommended (not
by me, anyway...), because it has many drawbacks (modify the tcl code will
modify *all* your dialogs and you won't be able to simply distribute your script
with the appearence changes: you'll have to distribute the new tcl code for the
dialogs too...)

So if you really want to do that, the simplest way is definetely to avoid using
the tkMessageBox module and to design your own dialogs.

HTH
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,213
Messages
2,571,106
Members
47,699
Latest member
lovelybaghel

Latest Threads

Top