Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
idlelib.ScrolledList.ScrolledList Class Reference
Inheritance diagram for idlelib.ScrolledList.ScrolledList:
Inheritance graph
[legend]
Collaboration diagram for idlelib.ScrolledList.ScrolledList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def close
def clear
def append
def get
def click_event
def double_click_event
def popup_event
def make_menu
def up_event
def down_event
def select
def fill_menu
def on_select
def on_double

Public Attributes

 master
 frame
 vbar
 listbox
 empty

Static Public Attributes

string default = "(None)"
 menu = None

Detailed Description

Definition at line 3 of file ScrolledList.py.


Constructor & Destructor Documentation

def idlelib.ScrolledList.ScrolledList.__init__ (   self,
  master,
  options 
)

Definition at line 7 of file ScrolledList.py.

00007 
00008     def __init__(self, master, **options):
00009         # Create top frame, with scrollbar and listbox
00010         self.master = master
00011         self.frame = frame = Frame(master)
00012         self.frame.pack(fill="both", expand=1)
00013         self.vbar = vbar = Scrollbar(frame, name="vbar")
00014         self.vbar.pack(side="right", fill="y")
00015         self.listbox = listbox = Listbox(frame, exportselection=0,
00016             background="white")
00017         if options:
00018             listbox.configure(options)
00019         listbox.pack(expand=1, fill="both")
00020         # Tie listbox and scrollbar together
00021         vbar["command"] = listbox.yview
00022         listbox["yscrollcommand"] = vbar.set
00023         # Bind events to the list box
00024         listbox.bind("<ButtonRelease-1>", self.click_event)
00025         listbox.bind("<Double-ButtonRelease-1>", self.double_click_event)
00026         listbox.bind("<ButtonPress-3>", self.popup_event)
00027         listbox.bind("<Key-Up>", self.up_event)
00028         listbox.bind("<Key-Down>", self.down_event)
00029         # Mark as empty
00030         self.clear()

Here is the caller graph for this function:


Member Function Documentation

def idlelib.ScrolledList.ScrolledList.append (   self,
  item 
)

Definition at line 39 of file ScrolledList.py.

00039 
00040     def append(self, item):
00041         if self.empty:
00042             self.listbox.delete(0, "end")
00043             self.empty = 0
00044         self.listbox.insert("end", str(item))

Here is the caller graph for this function:

Definition at line 34 of file ScrolledList.py.

00034 
00035     def clear(self):
00036         self.listbox.delete(0, "end")
00037         self.empty = 1
00038         self.listbox.insert("end", self.default)

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.click_event (   self,
  event 
)

Definition at line 48 of file ScrolledList.py.

00048 
00049     def click_event(self, event):
00050         self.listbox.activate("@%d,%d" % (event.x, event.y))
00051         index = self.listbox.index("active")
00052         self.select(index)
00053         self.on_select(index)
00054         return "break"

Here is the call graph for this function:

Definition at line 31 of file ScrolledList.py.

00031 
00032     def close(self):
00033         self.frame.destroy()

Here is the caller graph for this function:

Definition at line 55 of file ScrolledList.py.

00055 
00056     def double_click_event(self, event):
00057         index = self.listbox.index("active")
00058         self.select(index)
00059         self.on_double(index)
00060         return "break"

Here is the call graph for this function:

def idlelib.ScrolledList.ScrolledList.down_event (   self,
  event 
)

Definition at line 90 of file ScrolledList.py.

00090 
00091     def down_event(self, event):
00092         index = self.listbox.index("active")
00093         if self.listbox.selection_includes(index):
00094             index = index + 1
00095         else:
00096             index = 0
00097         if index >= self.listbox.size():
00098             self.listbox.bell()
00099         else:
00100             self.select(index)
00101             self.on_select(index)
00102         return "break"

Here is the call graph for this function:

Reimplemented in idlelib.Debugger.StackViewer.

Definition at line 112 of file ScrolledList.py.

00112 
00113     def fill_menu(self):
00114         pass

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.get (   self,
  index 
)

Definition at line 45 of file ScrolledList.py.

00045 
00046     def get(self, index):
00047         return self.listbox.get(index)

Here is the caller graph for this function:

Definition at line 72 of file ScrolledList.py.

00072 
00073     def make_menu(self):
00074         menu = Menu(self.listbox, tearoff=0)
00075         self.menu = menu
00076         self.fill_menu()

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.on_double (   self,
  index 
)

Reimplemented in idlelib.Debugger.StackViewer.

Definition at line 118 of file ScrolledList.py.

00118 
00119     def on_double(self, index):
00120         pass
00121 

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.on_select (   self,
  index 
)

Reimplemented in idlelib.Debugger.StackViewer.

Definition at line 115 of file ScrolledList.py.

00115 
00116     def on_select(self, index):
00117         pass

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.popup_event (   self,
  event 
)

Reimplemented in idlelib.Debugger.StackViewer.

Definition at line 63 of file ScrolledList.py.

00063 
00064     def popup_event(self, event):
00065         if not self.menu:
00066             self.make_menu()
00067         menu = self.menu
00068         self.listbox.activate("@%d,%d" % (event.x, event.y))
00069         index = self.listbox.index("active")
00070         self.select(index)
00071         menu.tk_popup(event.x_root, event.y_root)

Here is the call graph for this function:

def idlelib.ScrolledList.ScrolledList.select (   self,
  index 
)

Definition at line 103 of file ScrolledList.py.

00103 
00104     def select(self, index):
00105         self.listbox.focus_set()
00106         self.listbox.activate(index)
00107         self.listbox.selection_clear(0, "end")
00108         self.listbox.selection_set(index)
00109         self.listbox.see(index)

Here is the caller graph for this function:

def idlelib.ScrolledList.ScrolledList.up_event (   self,
  event 
)

Definition at line 77 of file ScrolledList.py.

00077 
00078     def up_event(self, event):
00079         index = self.listbox.index("active")
00080         if self.listbox.selection_includes(index):
00081             index = index - 1
00082         else:
00083             index = self.listbox.size() - 1
00084         if index < 0:
00085             self.listbox.bell()
00086         else:
00087             self.select(index)
00088             self.on_select(index)
00089         return "break"

Here is the call graph for this function:


Member Data Documentation

Definition at line 5 of file ScrolledList.py.

Definition at line 36 of file ScrolledList.py.

Definition at line 10 of file ScrolledList.py.

Definition at line 14 of file ScrolledList.py.

Definition at line 9 of file ScrolledList.py.

Definition at line 61 of file ScrolledList.py.

Definition at line 12 of file ScrolledList.py.


The documentation for this class was generated from the following file: