Code Comments
Programming Forum and web based access to our favorite programming groups.hi i just started using Tk i have made a left frame with some radiobuttons that is supposed to show different widgets on a right frame whenever the user clicks on it. For example, if user clicks on Radiobutton 1, the right frame will display a button. I have created a Text box in the frame and embedded the button inside this Text box. I find that whenever i click many times on Radiobutton 1 , the button is drawn. I only want to draw the button once whenever the user clicks radiobutton 1, how do i do that? another question is if the user click on Radiobutton 2, i want to clear the button in the Text box. So far , i used destroy to destroy the whole Text box and recreate again. I am sure there is more elegant way of removing widgets inside a Text box. How can i remove the button from the Text box ? thanks
Post Follow-up to this messagejustme wrote: > hi > i just started using Tk > i have made a left frame with some radiobuttons that is supposed to > show different widgets on a right frame whenever the user clicks on > it. For example, if user clicks on Radiobutton 1, the right frame will > display a button. I have created a Text box in the frame and embedded > the button inside this Text box. Why a Text widget? Why not keep it as a frame and create the button inside that frame? It will make life easier. > I find that whenever i click many times on Radiobutton 1 , the button > is drawn. I only want to draw the button once whenever the user clicks > radiobutton 1, how do i do that? By keeping a record of whether you created the button or not. If you did, then simply return from the Radiobutton1 callback before you create the button again. > another question is if the user click on Radiobutton 2, i want to > clear the button in the Text box. So far , i used destroy to destroy > the whole Text box and recreate again. I am sure there is more elegant > way of removing widgets inside a Text box. How can i remove the button > from the Text box ? $button->destroy; But I have a feeling your approaching your problem from the wrong angle. If you tell us more about your application, perhaps someone can suggest a better approach. --Ala
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.