diff options
author | Guido van Rossum <guido@python.org> | 1999-03-10 05:10:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-03-10 05:10:49 (GMT) |
commit | ac1cb16efba3e0bd09cbcd8d11e10611637da885 (patch) | |
tree | e6f99b25915cd92ea9e00258e38344b0a3107de9 | |
parent | 29aab7582f635e7041631b6e540c3b454c37450e (diff) | |
download | cpython-ac1cb16efba3e0bd09cbcd8d11e10611637da885.zip cpython-ac1cb16efba3e0bd09cbcd8d11e10611637da885.tar.gz cpython-ac1cb16efba3e0bd09cbcd8d11e10611637da885.tar.bz2 |
- White background.
- Display "(None)" (or text of your choosing) when empty.
- Don't set the focus.
-rw-r--r-- | Tools/idle/ScrolledList.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Tools/idle/ScrolledList.py b/Tools/idle/ScrolledList.py index a5f9a29..7fb1c20 100644 --- a/Tools/idle/ScrolledList.py +++ b/Tools/idle/ScrolledList.py @@ -1,6 +1,8 @@ from Tkinter import * class ScrolledList: + + default = "(None)" def __init__(self, master, **options): # Create top frame, with scrollbar and listbox @@ -9,7 +11,8 @@ class ScrolledList: self.frame.pack(fill="both", expand=1) self.vbar = vbar = Scrollbar(frame, name="vbar") self.vbar.pack(side="right", fill="y") - self.listbox = listbox = Listbox(frame, exportselection=0) + self.listbox = listbox = Listbox(frame, exportselection=0, + background="white") if options: listbox.configure(options) listbox.pack(expand=1, fill="both") @@ -22,16 +25,21 @@ class ScrolledList: listbox.bind("<ButtonPress-3>", self.popup_event) listbox.bind("<Key-Up>", self.up_event) listbox.bind("<Key-Down>", self.down_event) - # Set the focus - listbox.focus_set() + # Mark as empty + self.clear() def close(self): self.frame.destroy() def clear(self): self.listbox.delete(0, "end") + self.empty = 1 + self.listbox.insert("end", self.default) def append(self, item): + if self.empty: + self.listbox.delete(0, "end") + self.empty = 0 self.listbox.insert("end", str(item)) def get(self, index): |