Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

http://docs.python.org/library/functions.html#setattr

PyQt4

Open/close/move other GUI window

...

Try to close window if its object exists, othervise - open:

...

Note

Sometime it looks like the window does not want to move in specified position...
In particular I have observed, that everything is going correct untill the w.show(). then, suddenly happens moveEvent(), which changes the self.pos(). In my case it happened because at construction of the combined window, its size was changed and it was moved in origin... Reservation of larger window size solved this problem.

Close window and delete object

...

Code Block
    def closeEvent(self, event):
        try: # try to delete self object in the cp.confpars
            del cp.confpars.guiconfigparameters 
        except # AttributeError:
            pass # silently ignore

Change style of GUI basic widgets depending on status

For

Code Block

self.but_path = QtGui.QPushButton('File:')
self.but_path.setObjectName('but_path')
self.but_path.setStyleSheet('QPushButton#but_path:pressed  {color: black; background-color: green;}' +
                                    'QPushButton#but_path:disabled {color: white; background-color: pink;}' +
                                    'QPushButton                   {color:  blue; background-color: yellow;}')
Code Block

Matplotlib

In examples below we assume

...