开发者

How do I clear a Frame's value in Perl/Tk?

In Perl/Tk I have designed one interface in that I have one frame. That frame has an Entry and Text box. When I am clicking the button 开发者_如何学Go those Entry and Text value has to clear in the Frame. I know that I can access each object then I can clear using delete function. I need to do as like HTML form reset button functionality. How can I do these things in Perl Tk?


Create a button that has access to the variables holding the values for the other widgets you want to affect. When you press the button, reset the values in those variables.

Can you show us what you have tried to far?


There are a ton of ways to handle this, which way will work best depends on your application and how it is structured.

In general bind a subroutine to the 'Reset' button that will clear the values of the other widgets. The actual mechanics of how you clear the widgets will vary.

Off the top of my head here are three ways to go:

  • If the widgets are bound to scalars, you could clear those scalars.
  • If the widgets are set to update an object, you could clear the values in the object.
  • You could access the widget objects directly and clear them using their built-in methods.

There are probably as many more ways to do this. Selecting which one is difficult without seeing your code to see what will fit with your coding style.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜