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

simple GUI question

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
Jul 18 '05 #1
5 1652
Roose wrote:
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 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

Jul 18 '05 #2
> 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...


Jul 18 '05 #3
Roose said unto the world upon 2004-12-08 02:23:
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...


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&b tnG=Search&meta=>

Best,

Brian vdB
Jul 18 '05 #4
Brian van den Broek said unto the world upon 2004-12-08 03:16:

<SNIP>
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&b tnG=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

Jul 18 '05 #5
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
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
Jul 18 '05 #6

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

Similar topics

7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.