[PyQt] derive from a designer widget
Andreas Pakulat
apaku at gmx.de
Fri Mar 13 13:42:54 GMT 2009
On 13.03.09 06:36:04, Mario Daniel Carugno wrote:
> 2009/3/12 Mario Daniel Carugno <carugnom at gmail.com>:
> > 2009/3/12 Andreas Pakulat <apaku at gmx.de>:
> >>> Thank you Andreas, i'll try it. Just in case, do you have some example
> >>> of that ?
> >>
> >> Its pretty easy (from the top of my head, so might not work right away, but
> >> you should get the idea)
> >>
> >> class MyMainWindow(QMainWindow):
> >> def __init__(self,parent):
> >> QMainWindow.__init__(self,parent)
> >> self.ui = Ui_MainWindow()
> >> self.ui.setupUi(this)
> >>
> >> class MyCustomMainWindow(MyMainWindow):
> >> def __init__(self,parent):
> >> MyMainWindow.__init__(self,parent)
> >> self.mybutton = QPushButton(self.ui.centralFrame)
> >>
> >
> > Great ! Thank you very much
>
> I've tried the example, and that's not exactly what i need.
> But it helped me to get a better idea of what i want.
> Ok, i want to design a 'main window' with navigation buttons
> and a central area.
> Then i design a separate widget 'data' (the records to show)
> to put in the main window's central area.
> But how to put it there and 'integrate' both ? That's the hard point.
Write python script code that creates an instance of the 'data' widget and
adds it to the 'mainwindow' layout.
> I want that it could be as simple as derivating the 'data' class
> from the 'main window' class. I've read that derivating a widget
> from another one, makes that widget to appear inside it's parent,
> right ?
No thats wrong. Deriving one class from another is something different than
adding a widget to a parent widget.
Andreas
--
Don't get stuck in a closet -- wear yourself out.
More information about the PyQt
mailing list