[Q]Popping up ComboBox

Seung-won Hwang shwang5 at students.uiuc.edu
Sat Aug 11 09:27:26 CEST 2001


Hi, I'm newbie in Tkinterprogramming. I'd like to pop up the form as below
in the callback function of menubar and keep failing... Any code example or
help would be very helpful to me.

Bests,
SW

---

#!c:\python21\python
from Tkinter import *
from tkSimpleDialog import Dialog
import Pmw

class MixedWidgets(Dialog):

    def body(self, master):
        Label(master, text='Select ').grid(row=0, sticky=W)
        Label(master, text='Select ').grid(row=1, sticky=W)
        Label(master, text='Enter ').grid(row=2, sticky=W)

        self.combo1 = Pmw.ComboBox(master,

scrolledlist_items=("Min","Avg","Custom"),
                                   entry_width=12, entry_state="disabled")
        self.combo1.component('entry').config(background='gray80')

        self.combo2 = Pmw.ScrolledListBox(master,
listbox_selectmode=MULTIPLE,
          items=('a','b','c'))
        #self.combo2.component('entry').config(background='gray80')

        self.entry1  = Entry(master, width = 12)

        self.combo1.grid(row=0, column=1, sticky=W)
        self.combo2.grid(row=1, column=1, sticky=W)
        self.entry1.grid(row=2, column=1, sticky=W)

        return self.combo1

    def apply(self):
        c1 = self.combo1.get()
        c2 = self.combo2.get()
        e1 = self.entry1.get()
        print c1, c2, e1

root = Tk()
dialog = MixedWidgets(root)





More information about the Python-list mailing list