﻿

# MultiListboxTortureCode

May 11th, 2014
367
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1.     def get(self, first, last=None):
2.         result = []
3.         for l in self.lists:
4.             result.append(l.get(first, last))
5.         if last: return list(map(*[None] + result))
6.         return result
7.
8.     def index(self, index):
9.         self.lists[0].index(index)
10.
11.     def insert(self, index, *elements):  #Elements = the fields in a row.
12.         # Loop through each field in the row
13.         for e in elements:
14.             # Each field will have an index number. Ex: e[0] = ID, e[1] = Date, etc.
15.             i = 0
16.             for l in self.lists:
17.                 # Insert each field in its applicable list box
18.                 # Insert a blank if the field is None, otherwise boxes won't align.
19.                 if e[i] == None:
20.                     l.insert(index, " ")
21.                 else:
22.                     l.insert(index, e[i])
23.                 i = i + 1
24.
25.     def Size(self):
26.         return self.lists[0].size()
27.
28.     def see(self, index):
29.         for l in self.lists:
30.             l.see(index)
31.
32.     def SelectionClear(self, first, last=None):
33.         # Unselects the entire line by looping over each of the list boxes that make up the MLB.
34.         for l in self.lists:
35.             l.selection_clear(first, last)
36.
37.     def SelectionSet(self, first, last=None)
38.         self.item_selected = [first, ] + self.get(first)
39.
40.         for l in self.lists:
41.             # Sets the selection to the same row in all list boxes
42.             l.selection_set(first, last)
43.
44.     def not_focus(self):
45.         for l in self.lists:
46.             l['takefocus'] = False
RAW Paste Data