Menu

Missing title bars in Pmw.Dialog boxes

Help
Emma
2013-11-29
2013-12-02
  • Emma

    Emma - 2013-11-29

    Hi all

    I'm having some problems with Title bars not showing up when using Pmw.Dialog boxes. This makes it so that you can't move the window around, since you can't grab the title bar.

    I'm running Python 2.7.5 and Pmw 1.3.3 through Cygwin64, on a Windows 8 computer. When I run on pure windows (using the Windows version of Python 2.7.3 and Pmw 1.3.3), I do NOT have this same problem.

    Has anyone seen this before, and do you know what I can do to fix it?

    I have included a simple demo program below, where I experience this problem (it is part of a demo from the Pmw reference pages). The FIRST time I click the "Show Application" button, the dialog window that pops up is missing the title bar. However if I close the dialog button and click "Show Application" again, the title bar appears as normal.

    Any help with this would be greatly appreciated!

    Thank you
    Emma

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    #!/usr/bin/python
    import Tkinter
    import Pmw
    
    class Demo:
        def __init__(self, parent):
            # Create button to launch the dialog.
            w = Tkinter.Button(parent, text = 'Show application modal dialog',
                command = self.showAppModal)
            w.pack(padx = 8, pady = 8)
    
            # Create the dialog.
            self.dialog = Pmw.Dialog(parent,
                buttons = ('OK', 'Apply', 'Cancel', 'Help'),
                defaultbutton = 'OK',
                title = 'My dialog',
                command = self.execute)
            self.dialog.withdraw()
    
            # Add some contents to the dialog.
            w = Tkinter.Label(self.dialog.interior(),
                text = 'Pmw Dialog\n(put your widgets here)',
                background = 'black',
                foreground = 'white',
                pady = 20)
            w.pack(expand = 1, fill = 'both', padx = 4, pady = 4)
    
        def showAppModal(self):
            self.dialog.activate(geometry = 'centerscreenalways')
    
        def execute(self, result):
            print 'You clicked on', result
            if result not in ('Apply', 'Help'):
                self.dialog.deactivate(result)
    
    root=Tkinter.Tk()
    Pmw.initialise(root)
    myDemo = Demo(root)
    root.mainloop()
    
     
    • Emma

      Emma - 2013-12-02

      Hi again all. Just wanted to follow this up, in case someone else runs into the same issue. I found a work-around, which does a "refresh" of the title-less Dialog window, and this works. I just have to kill the Dialog, and launch it again, and the second time the title shows up. So I replaced the "showAppModal" function above with the following:

      1
      2
      3
      4
      5
      6
      7
      8
      #!/usr/bin/python
      def refresh(self):
          self.dialog.deactivate()
          self.dialog.activate(geometry = 'centerscreenalways')
      
      def showAppModal(self):
          self.dialog.after(100, self.refresh)
          self.dialog.activate(geometry = 'centerscreenalways')
      
       

Log in to post a comment.