Bitmaps On Buttons ?

P

PGMoscatt

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,command=callquit,)
b.bitmap="@button_cancel.xbm"
b.place(x=0,y=0)
 
M

Martin Franklin

PGMoscatt said:
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,command=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
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top