python - Clearing tkinter entry box after displayed result -


i'm calculating seconds h:m:s format , using tkinter it. got program done there's issue it. calculates first result perfectly, when press calculate again, concatenates result. how fix clears first result when user wants calculate again? tried using self.result.delete(0,end), displays nothing after calculate. here functions problem in question.

the below demonstrates how can clear entry widget using button:

from tkinter import *  class app:     def __init__(self, root):         self.root = root         self.entry = entry(self.root)         self.button = button(root, text="ok", command=self.command)         self.entry.pack()         self.button.pack()     def command(self):         self.entry.delete(0, end)  root = tk() app(root) root.mainloop() 

the code pretty self explanatory, self.entry.delete(0, end) remove text in entry position '0' position 'end'.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -