Last change
on this file since 1339 was
1306,
checked in by KelvinHsu, 11 years ago
|
Initial commit of early python tests
|
File size:
544 bytes
|
Rev | Line | |
---|
[1306] | 1 | from Tkinter import * |
---|
| 2 | master = Tk() |
---|
| 3 | |
---|
| 4 | e = Entry(master, width=50) |
---|
| 5 | e.pack() |
---|
| 6 | |
---|
| 7 | text = e.get() |
---|
| 8 | |
---|
| 9 | def makeentry(parent, caption, width=None, **options): |
---|
| 10 | Label(parent, text=caption).pack(side=LEFT) |
---|
| 11 | entry = Entry(parent, **options) |
---|
| 12 | if width: |
---|
| 13 | entry.config(width=width) |
---|
| 14 | entry.pack(side=LEFT) |
---|
| 15 | return entry |
---|
| 16 | |
---|
| 17 | user = makeentry(master, "User name:", 10) |
---|
| 18 | password = makeentry(master, "Password:", 10, show="*") |
---|
| 19 | |
---|
| 20 | content = StringVar() |
---|
| 21 | entry = Entry(master, text= 'blah' , textvariable=content) |
---|
| 22 | |
---|
| 23 | text = content.get() |
---|
| 24 | content.set(text) |
---|
Note: See
TracBrowser
for help on using the repository browser.