By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

Bitmaps On Buttons ?

P: n/a
I am slowly progressing with my python app.

I have got to the point where I would like to place images onto my buttons.
I use Tkinter as my GUI libary.

The following is how I understand I place an image onto a button - but I am
not having much success with it all.

Any ideas ?

Pete

b=Button(ToolBar,padx=1,pady=1,width=2,height=1,co mmand=callquit,)
b.bitmap="@button_cancel.xbm"
b.place(x=0,y=0)

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
PGMoscatt wrote:
I am slowly progressing with my python app.

I have got to the point where I would like to place images onto my buttons.
I use Tkinter as my GUI libary.

The following is how I understand I place an image onto a button - but I am
not having much success with it all.

Any ideas ?

Pete

b=Button(ToolBar,padx=1,pady=1,width=2,height=1,co mmand=callquit,)
b.bitmap="@button_cancel.xbm"
b.place(x=0,y=0)


put the bitmap= inside the construction of the button widget like so:

b = Button(ToolBar, padx=1, pady=1, width=2, height=1, command=callquit,
bitmap="@button_cancel.xbm")

BTW You shouldn't need to set the height and width - the button will
take it's size from the bitmap

BTW2 I notice you are using place geometry manager you may get a
'better' behaved GUI with the pack or grid geometry manager, it will
resize much better as widgets are pack'ed or grid'ed relative to each other

for more help you could try:

http://www.pythonware.com/library/tkinter/introduction/

or the Wiki that has links to other sources of help (including the
Tkinter mailing list

http://tkinter.unpythonic.net/wiki/FrontPage

Cheers
Martin


Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.