Help with buttons and entry fields
Steve Holden
sholden at holdenweb.com
Tue Sep 5 14:13:01 EDT 2000
More information about the Python-list mailing list
Tue Sep 5 14:13:01 EDT 2000
- Previous message (by thread): NEWBIE: Can't find conftest.c
- Next message (by thread): Help with buttons and entry fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Assuming you are still using Tkinter, the code below should elucidate.
The button's callback uses the special insert position END to append
something tpo the entry's current value.
HTH
regards
Steve
Dudek7 wrote:
>
> Heres a newbie question. I have a button and an entry field. Does anyone
> know how to get the entry field to display the number "1" whenever i press
> the button?
> Like if i press button 5 times there are 5 ones?
>
> Please help me.
>
> thanks
from Tkinter import *
class createStuff:
def __init__(self, window=None):
self.button = Button(window, text="Click Me", command=self.addaone)
self.entry = Entry(window)
self.button.pack()
self.entry.pack()
def addaone(self):
self.entry.insert(END, "1")
def close(self):
self.quit()
if __name__ == "__main__":
root = Tk()
win = createStuff(root)
root.mainloop()
--
Helping people meet their information needs with training and technology.
703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/
- Previous message (by thread): NEWBIE: Can't find conftest.c
- Next message (by thread): Help with buttons and entry fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list