[PyQt] Call a window from other parent window
Michael Towers
gradgrind at online.de
Wed Oct 17 08:44:51 BST 2007
A couple of (also untested) tweaks?
Mark Summerfield wrote:
> On 2007-10-16, Sergio Jovani Guzmán wrote:
>
>> Hi all!
>>
>> I am learning PyQt and I have a question.
>>
>> I have two classes, one for each widget:
>>
>> ==================
>> class Main(QMainWindow):
>> def __init__(self):
>> QMainWindow.__init__(self)
>> loadUi("frmmain.ui", self)
>>
>> class Conectar(QDialog):
>>
>> def __init__(self):
>> QDialog.__init__(self)
>> loadUi("frmconectar.ui", self)
>> =====================
>>
>> My question is, how can I call and show a widget from other with parent?
>>
>> For example, open Conectar() window from Main() window?
>>
>> Many thanks!
>>
>
> You need a method in your Main() class, something like this (untested):
>
> def runConectar(self):
> conectar = Conectar(self)
> if conectar.exec():
>
if conectar.exec_():
> pass # User clicked OK
>
> And in the Main() __init__ method, assuming you have an action called
> runConectarAction:
>
> self.connect(runConectarAction, SIGNAL("triggered()"),
> self.runConectar)
>
>
self.connect(runConectarAction, SIGNAL("triggered(bool)"),
self.runConectar)
More information about the PyQt
mailing list