Dynamically changing button text in python
Paul Rubin
phr at localhost.localdomain
Sun Jan 15 03:50:08 EST 2006
marijuanated at gmail.com writes:
> The problem is once i set the textvariable property of the button,i
> cannot change the text.For example,
>
> curButton = Button(root,text="Stop Server",textvariable="this")
1. I don't think you can use text and textvariable at the same time.
2. I don't think you're using textvariable the right way.
Try something like:
tv = StringVar()
curButton = Button(root, textvariable=tv)
curButton.bind("<Button-1>",self.StopServer)
def StopServer(self,event):
tv.set("Start Server")
--Paul
More information about the Python-list
mailing list