Scrolled list question
mongo57a at comcast.net
mongo57a at comcast.net
Mon Sep 30 19:42:17 EDT 2002
Trying to make more than one data element appear in a scrolled list. The
window is formed properly; the first piece of data is there, but I don't
know how to get the rest of the data in (see comments in code below).
if __name__ == '__main__':
sqlcmd = sql.Build_Query (command, tables, columns, condition, sort) #
custom code - works fine
dbinfo = sql.Query (sqlcmd) #custom code works fine
for i in range(20):
symbol = dbinfo.Symbol[i]
action = dbinfo.Action[i]
dislist = string.join([symbol, action],' ') # joins the 2 strings
ScrolledList(dislist)
mainloop()
class ScrolledList(Frame):
def __init__(self, label, parent=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH) # make me
expandable
self.makeWidgets(label)
def handleList(self, event):
index = self.listbox.curselection() # on list
double-click
label = self.listbox.get(index) # fetch selection
text
self.runCommand(label) # and call action
here
def makeWidgets(self,label):
sbar = Scrollbar(self)
list = Listbox(self, relief=SUNKEN)
sbar.config(command=list.yview) # xlink sbar and
list
list.config(yscrollcommand=sbar.set) # move one moves
other
sbar.pack(side=RIGHT, fill=Y) # pack first=clip
last
list.pack(side=LEFT, expand=YES, fill=BOTH) # list clipped
first
The preceding puts the first value of dislist into the window - as it
should. So how do I get the rest of them in there? I'm not a very
experienced programmer...... tried dislist[i] with ScrolledList(dislist) and
got errors.
TIA.
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
More information about the Python-list
mailing list