Q: How to Change Pmw.ComboBox width ??

Discussion in 'Python' started by Camilo Olarte, Sep 26, 2003.

  1. Hello list,
    I was trying to make a Pmw.ComboBox and while using it i
    needed to change its width.
    I tried to configure it's inner components directly like _listbox.config
    but nothing changes..
    By default in my computer this combobox width is of 12 (characters)
    and since I am showing number of the month i need only 3 characters.
    i could use a Pmw.Counter but my boss don't likes it's arrows :( ...

    Here is some sample code of what i'm doing.

    <PYTHON>
    import Tkinter, Pmw
    class DemoCombo:
    def __init__(self, parent):
    parent.configure(background = 'white')
    arrmes = [1,2,3,4,5,6,7,8,9,10,11,12]
    # Create and pack the dropdown ComboBox.
    self.dropdown = Pmw.ComboBox(parent,label_text = 'Month:',
    labelpos = 'n',scrolledlist_items = arrmes,
    scrolledlist_usehullsize = 1,)
    # How do I change pmw combobox width ...
    # self.dropdown.configure(width =2) ...Na didn't change widht
    # self.dropdown._list.configure(width =2) ...Na didn't change widht
    # self.dropdown._list._listbox.configure(width =2) ...Na didn't cha
    nge widht
    self.dropdown.pack(side = 'top')
    self.dropdown.selectitem(0) # Display the first element

    def fnShow(self):
    print self.dropdown.get()
    ###################################
    # Create demo in root window for testing.
    if __name__ == '__main__':
    root = Tkinter.Tk()
    Pmw.initialise(root, fontScheme = 'pmw1')
    widget = DemoCombo(root)
    Frm = Tkinter.Frame(root)
    testBtn = Tkinter.Button(Frm, text = 'Print Month',
    testBtn.pack(side = 'left')
    exitBtn = Tkinter.Button(Frm, text = 'Exit',
    command = root.destroy)
    exitBtn.pack(side = 'right')
    Frm.pack()
    root.mainloop()

    </PYTHON>

    Camilo Olarte
     
    Camilo Olarte, Sep 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc
    Replies:
    0
    Views:
    373
  2. mark
    Replies:
    0
    Views:
    703
  3. Martin Franklin

    Re: Q: How to Change Pmw.ComboBox width ??

    Martin Franklin, Sep 26, 2003, in forum: Python
    Replies:
    0
    Views:
    1,308
    Martin Franklin
    Sep 26, 2003
  4. Gombos Katalin

    Pmw.ComboBox

    Gombos Katalin, Oct 20, 2003, in forum: Python
    Replies:
    1
    Views:
    551
    Eric Brunel
    Oct 20, 2003
  5. Gombos Katalin

    Pmw.ComboBox

    Gombos Katalin, Dec 10, 2003, in forum: Python
    Replies:
    0
    Views:
    372
    Gombos Katalin
    Dec 10, 2003
Loading...

Share This Page