Trouble with Pmw ComboBox get()
Cindy Huyser
chuyser at flash.net
Mon May 1 08:38:35 EDT 2000
I have a form on which I am using several combo boxes to get
information. I
have been using the info to build a tuple to pass to a function, and
it's been
working well. Now, suddenly, all I get from the get() function are
the
default selected values; I'm beginning to suspect I have a mean hidden
character somewhere.
Any ideas? The code declaring the boxes and then getting info from
them is
pasted below.
Regards,
Cindy Huyser
self.courseCombo=Pmw.ComboBox(self.courseCRow1, entry_width=8,
listbox_width=10,dropdown=1,
scrolledlist_items=self.courses)
self.courseCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.courseCombo.selectitem(self.courses[0])
self.facultyCombo=Pmw.ComboBox(self.courseCRow1,
listbox_width=10,dropdown=1,
scrolledlist_items=self.faculty)
self.facultyCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.facultyCombo.selectitem(self.faculty[0])
self.dayCombsCombo=Pmw.ComboBox(self.courseCRow1, entry_width=6,
listbox_width=10,dropdown=1,
scrolledlist_items=self.dayCombs)
self.dayCombsCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.dayCombsCombo.selectitem(self.dayCombs[0])
self.startTimeCombo=Pmw.ComboBox(self.courseCRow1, entry_width=8,
listbox_width=10,dropdown=1,
scrolledlist_items=self.startTimes)
self.startTimeCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.startTimeCombo.selectitem(self.startTimes[0])
self.timeBlockCombo=Pmw.ComboBox(self.courseCRow1,
entry_width=10,
listbox_width=10,dropdown=1,
scrolledlist_items=self.timeBlocks)
self.timeBlockCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.timeBlockCombo.selectitem(self.timeBlocks[0])
self.roomsCombo=Pmw.ComboBox(self.courseCRow1,entry_width=12,
listbox_width=10,dropdown=1,
scrolledlist_items=self.allRooms)
self.roomsCombo.pack(side=LEFT, expand=1, padx=5, pady=2)
self.roomsCombo.selectitem(self.allRooms[0])
self.labCheck=Checkbutton(self.courseCRow1, text="",
state=NORMAL,
variable=self.labStatus)
self.labCheck.pack(side=LEFT)
(LATER...)
def addClass(self, courseToAdd=None):
while len(self.newCourse)>0:
del self.newCourse[0]
# Function works for passed parameter and combo box read
if not courseToAdd:
self.newCourse.append((self.courseCombo.get(),
self.facultyCombo.get(),
self.dayCombsCombo.get(),
self.startTimeCombo.get(),
self.timeBlockCombo.get(),
self.roomsCombo.get(),
self.labStatus.get()))
else:
self.newCourse.append(courseToAdd)
self.getIndices(self.newCourse[0])
# Find conflicts and append them to conflicts dictionary
foundConflict=self.findConflicts(self.newCourse[0],
self.courseIndices)
# If conflict found, prompt the user
if foundConflict==1:
answer=askyesno("Conflict Detected", "Adding this course will
produce
a conflict. Do
you want to schedule it anyway?")
if answer==1:
# Append the class to the list of classes
self.schedule.append(self.newCourse[0])
# Append the course to the course dictionary
for item in self.courseIndices:
self.classSchedule[item].append(self.newCourse[0])
# Course schedule has been updated; send course to make
room changes
self.grid.redraw(1, self.newCourse)
else:
# Undo the change to the conflicts dictionary
self.removeConflicts(self.newCourse[0], self.courseIndices)
elif foundConflict==0:
# Append the class to the list of classes
self.schedule.append(self.newCourse[0])
# Append the course to the course dictionary
for item in self.courseIndices:
self.classSchedule[item].append(self.newCourse[0])
More information about the Python-list
mailing list