![]() |
PyQt Stacked Windows Example
Hi,
somebody could post code example to do Qt Stacked Windows with python ? I try to do a main window with 4 buttons. Each button must open a new window with 4 more buttons and a back arrow on top right to back to the first windows. |
Re: PyQt Stacked Windows Example
|
Re: PyQt Stacked Windows Example
|
Re: PyQt Stacked Windows Example
That's a PySide example (which won't quite work with Qt4.5, even if you convert it to PyQt :) ). For that, I believe you should do something like
myMainWindow = QtGui.QMainWindow() myStackedWindow = QtGui.QMainWindow(myMainWindow) |
Re: PyQt Stacked Windows Example
@Atilla77
I got stacked windows working in my main.py like this (where MainWindow is subclass of QMainWindow) Code:
Any clues how I can parent my stacked window outside of the main.py? |
Re: PyQt Stacked Windows Example
Quote:
Can you not have your stacked window objects created inside your MainWindow or with some sort of Factory. |
Re: PyQt Stacked Windows Example
Quote:
I'm still learning my Python Parenting skills :D |
Re: PyQt Stacked Windows Example
I'm not sure I follow... but if you need your 'ui' var in another class, well, then you propagate it through that class' constructor.
Another thing is that with PyQt the signals/slots are evaluated dynamically, i.e. you can connect a (not yet existant) signal to a slot and then emit it later. This is not too pretty and should be avoided if you plan on re-implementing the code in C++, but can save a lot of time if done right. |
Re: PyQt Stacked Windows Example
Thanks atilla77
Got this all working nicely now. The key was to specify "self" in the call to make the stacked window here is class definition for my Stacked Window, which contains a couple of buttons and text edit widgets Code:
class StackedWindow(QtGui.QMainWindow): Code:
def on_actionPop_triggered(self): and you get the nice sliding sideways effect, and the back button on the top right hand corner. http://farm5.static.flickr.com/4056/...445851f20d.jpg Now I can finally make a nice config screen for my App:D |
Re: PyQt Stacked Windows Example
nicely done - will be using this i feel :D :D
|
All times are GMT. The time now is 23:17. |
vBulletin® Version 3.8.8