[Tkinter-discuss] Having an icon as a button, or a clickable icon

Alexnb alexnbryan at gmail.com
Mon Jul 14 00:18:57 CEST 2008




Cameron Laird-2 wrote:
> 
> On Sun, Jul 13, 2008 at 01:26:18PM -0700, Alexnb wrote:
> 			.
> 			.
> 			.
>> This is just something I've always wanted to do, and am just wondering
>> how to
>> do it. If the subject isn't clear, what I mean is like a button that
>> isn't
>> just text, like on a browser, the refresh button isn't "refresh" it is
>> typically the two little arrows. I am wondering how to make buttons like
>> that. If there is a way what is it? and what format should the image be
>> in?
>> should it be an icon, or a gif or whatever?
> 			.
> 			.
> 			.
> Look for "image" in <URL: http://effbot.org/tkinterbook/button.htm >.
> Does that leave any questions?
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 

Okay Thanks that was exactly what I wanted! But I have a new question about
it. So you know how you can make a stringvar() and like when you change it
everything changes. For example, what I am doing it I have a button and hte
text of the button is a string variable so when the action for the button is
done, it changes the text of the button to 'Done'. So I am wondering, is
there a way to like have the button image be one thing, and then when
something happens, it changes to another icon. Will just changing the
variable that the image is in then doing an update() work? like

image= PhotoImage(file="first image')
Button(master, image=image)
*Button is clicked*
image=PhotoImage(file="second image")
root.update()

Will something like that work? Or is there a better way?

-- 
View this message in context: http://www.nabble.com/Having-an-icon-as-a-button%2C-or-a-clickable-icon-tp18433498p18434587.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list