Re: [Tutor] Update a button content on click

2011-02-15 Thread ALAN GAULD
website http://www.alan-g.me.uk/ > >From: ANKUR AGGARWAL >To: ALAN GAULD >Cc: tutor@python.org >Sent: Tuesday, 15 February, 2011 17:14:38 >Subject: Re: [Tutor] Update a button content on click > >upper code posted earlier is running fine > > >The pr

Re: [Tutor] Update a button content on click

2011-02-15 Thread ANKUR AGGARWAL
ebsite > > http://www.alan-g.me.uk/ > > > *From:* ANKUR AGGARWAL > *To:* ALAN GAULD > *Cc:* tutor@python.org > *Sent:* Tuesday, 15 February, 2011 17:04:06 > *Subject:* Re: [Tutor] Update a button content on click > > from Tkinter import * > root=Tk() > > photo=

Re: [Tutor] Update a button content on click

2011-02-15 Thread ALAN GAULD
2011 17:04:06 >Subject: Re: [Tutor] Update a button content on click > > >from Tkinter import * >root=Tk() > > >photo=PhotoImage(file="Cross.gif") >def ok(): > b1["image"]=photo > > >b1=Button(root,text="",image=None,command=ok) &g

Re: [Tutor] Update a button content on click

2011-02-15 Thread ANKUR AGGARWAL
upper code posted earlier is running fine The problem is in the code below bcoz of the height nd width factor... from Tkinter import * root=Tk() photo=PhotoImage(file="Cross.gif") def ok(): b1["image"]=photo b1=Button(root,text="",image=None,height=4,width=4,command=ok) b1.grid() On Tue,

Re: [Tutor] Update a button content on click

2011-02-15 Thread ANKUR AGGARWAL
from Tkinter import * root=Tk() photo=PhotoImage(file="Cross.gif") def ok(): b1["image"]=photo b1=Button(root,text="",image=None,command=ok) b1.grid() root.mainloop() Here's my code . Not getting the desired output On Tue, Feb 15, 2011 at 10:26 PM, ALAN GAULD wrote: > > b1=button(root,image=N

Re: [Tutor] Update a button content on click

2011-02-15 Thread ALAN GAULD
> b1=button(root,image=None,height=4,width=4,command=ok) This says you want the button to e 4 pixels squarte. Is that really what you want?, because and then ok defination is as follows : > def ok(): > b1["image"]=photo > > >now problem is that after clicking on the button, image is coming

Re: [Tutor] Update a button content on click

2011-02-15 Thread ANKUR AGGARWAL
hmmm... i got the point. I applied it in image case. b1=button(root,image=None,height=4,width=4,command=ok) and then ok defination is as follows : def ok(): b1["image"]=photo now problem is that after clicking on the button, image is coming up like a flash and then button becomes almost to ze

Re: [Tutor] Update a button content on click

2011-02-15 Thread Alan Gauld
"ANKUR AGGARWAL" wrote I am looking for a method using Tkinter module to update the button on the click. Define an event handler command for the button. Lets call it sayHi() def sayHi(self): self.myButton['text'] = 'hi' # Note:event handlers don't return results so store it as an

[Tutor] Update a button content on click

2011-02-15 Thread ANKUR AGGARWAL
Hey I am looking for a method using Tkinter module to update the button on the click. Suppose I have a button with "hello" print on it. I want that when i click on it "hello" got updated with the "hi". New value button should return on the its click should be "hi". I tried it through event handling