Portál AbcLinuxu, 13. května 2025 21:01
class configui( QtGui.QDialog ): ... self.oform=uic.loadUi('UI/config.ui') ... x = animator( self.oform.label_set_up_pw, 5) x.timer.start( 500 ) class animator( QObject ): def __init__( self, widget, times ) : super( animator, self ).__init__() self.widget = widget self.count = 0 self.max_count = times self.w_status = True self.timer = QTimer() self.timer.timeout.connect( self.timerevent ) print "spouštím timer" def timerevent(self ): self.w_status = not( self.w_status ) print self.w_status self.widget.setVisible( self.status ) self.count += 1 if ( self.count >= self.max_count ) : self.widget.setVisible( True ) self.timer.stop()
Spouštím timer
se vypíše, ale dál to nic nedělá. Může mně ěkdo popostrčit, co mám špatně ?
Předem díky
Milan
Řešení dotazu:
self.widget.setVisible( self.status )
a přitom proměnnou máš self.w_status
x = animator( self.oform.label_set_up_pw, 5) x.timer.start( 500 ) na self.x = animator( self.oform.label_set_up_pw, 5) self.x.timer.start( 500 )už to jede, jak má Milan
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.