🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.python
3 messages
3 total messages Started by blackue Tue, 20 Jul 2010 20:27
nowe okno (pyqt)
#27588
Author: blackue
Date: Tue, 20 Jul 2010 20:27
50 lines
2022 bytes
Witam,
Próbuję znaleźć w necie dane rozwiązać (zapewne banalny) problem, ale nie udaje
mi się uzyskać informacji.

Mam okno Oferta i chciałem by po przyciśnięciu Dodaj pojawiało się nowe okno z
moim formularzem. Kod wygląda następująco (po wycięciu widgetów)

import sys
from PyQt4 import QtGui, QtCore


class Oferta(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.setWindowTitle('Oferta')

        ...

        dodajButt = QtGui.QPushButton('Dodaj', self)

        self.Prod = None
        self.connect(dodajButt, QtCore.SIGNAL('clicked()'), self.dodajOkno)
        ...
        self.resize(350, 300)

    def dodajOkno(self):
        self.Prod = Producent(self)
        self.show()

class Producent(QtGui.QWidget):
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)

        self.setWindowTitle('Oferta Producenta')
        self.resize(200, 100)
        self.setToolTip('This is a <b>QWidget</b> widget')

        print 'ja'

app = QtGui.QApplication(sys.argv)
qb = Oferta()
qb.show()
sys.exit(app.exec_())

Program pisze ów ,,ja'' ale okna nie wiedzę. Najlepiej by te okno było jako
potomek. Prosiłbym o wskazówki.

TIA
Pozdrawiam
Re: nowe okno (pyqt)
#27590
Author: Artur M. Piwko
Date: Wed, 21 Jul 2010 07:09
13 lines
1217 bytes
In the darkest hour on Tue, 20 Jul 2010 22:27:01 +0200,
blackue <WytnIJblackue@wp.pl> screamed:
>     def dodajOkno(self):
>         self.Prod = Producent(self)
>         self.show()

          self.Prod.show()

-- 
[ Artur M. Piwko : Pipen : AMP29-RIPE : RLU:100918 : From == Trap! : SIG:226B ]
[ 09:08:23 user up 12505 days, 21:03,  1 user, load average: 0.02, 0.18, 0.31 ]

               Bad command or file name.  Go stand in the corner.
Re: nowe okno (pyqt)
#27593
Author: blackue
Date: Wed, 21 Jul 2010 17:49
12 lines
1278 bytes
On 21.07.2010 09:09, Artur M. Piwko wrote:
> In the darkest hour on Tue, 20 Jul 2010 22:27:01 +0200,
> blackue <WytnIJblackue@wp.pl> screamed:
>>     def dodajOkno(self):
>>         self.Prod = Producent(self)
>>         self.show()
> 
>           self.Prod.show()
> 

Niestety wyeliminowanie tego błędu nie pomogło :/ nie rozumiem dlaczego okno się
nie pojawia ...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads