summaryrefslogtreecommitdiffstats
path: root/examples2/widgets.py
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-04-19 13:21:52 +0000
committerSlávek Banko <slavek.banko@axis.cz>2022-07-27 18:08:53 +0200
commit6be046642290c28c17949022fb66ae02ac21d544 (patch)
treee7b38b35a42b27569b26736afc4e472a2a5d672d /examples2/widgets.py
parent63fe0b82b47e7ee31f91374d96022a3ae77a86c3 (diff)
downloadpytqt-6be046642290c28c17949022fb66ae02ac21d544.tar.gz
pytqt-6be046642290c28c17949022fb66ae02ac21d544.zip
Updates to support Python version 3
Amendments to the sip source and configuration/build scripts to allow for support under Python version 3. The examples have been updated using "2to3" along with some manual changes to sort out intentation and casting to integer from float. Signed-off-by: aneejit1 <aneejit1@gmail.com> Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'examples2/widgets.py')
-rwxr-xr-xexamples2/widgets.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/examples2/widgets.py b/examples2/widgets.py
index fc36e7a..cf235a8 100755
--- a/examples2/widgets.py
+++ b/examples2/widgets.py
@@ -18,7 +18,7 @@ def TQMIN( x, y ):
class AnalogClock( TQWidget ):
def __init__( self, *args ):
- apply( TQWidget.__init__, (self,) + args )
+ TQWidget.__init__(*(self,) + args)
self.time = TQTime.currentTime() # get current time
internalTimer = TQTimer( self ) # create internal timer
self.connect( internalTimer, SIGNAL("timeout()"), self.timeout )
@@ -74,7 +74,7 @@ class AnalogClock( TQWidget ):
class DigitalClock( TQLCDNumber ):
def __init__( self, *args ):
- apply( TQLCDNumber.__init__,(self,) + args )
+ TQLCDNumber.__init__(*(self,) + args)
self.showingColon = 0
self.setFrameStyle(TQFrame.Panel | TQFrame.Raised)
self.setLineWidth( 2 )
@@ -112,7 +112,7 @@ class DigitalClock( TQLCDNumber ):
s[2] = ' '
if s[0] == '0':
s[0] = ' '
- s = string.join(s,'')
+ s = ''.join(s)
self.display( s )
def TQMIN( x, y ):
@@ -130,7 +130,7 @@ MOVIEFILENAME = "trolltech.gif"
class WidgetView ( TQWidget ):
def __init__( self, *args ):
- apply( TQWidget.__init__, (self,) + args )
+ TQWidget.__init__(*(self,) + args)
# Set the window caption/title
self.setCaption( "TQt Widgets Demo Application" )
@@ -186,14 +186,14 @@ class WidgetView ( TQWidget ):
TQToolTip.add( self.dclock, "custom widget: digital clock" )
# Create a push button.
- self.pb = TQPushButton( self, "button1" ) # create button 1
+ self.pb = TQPushButton( self, "button1" ) # create button 1
self.pb.setText( "Push button 1" )
self.pb.setFixedHeight( self.pb.sizeHint().height() )
self.grid.addWidget( self.pb, 0, 0, TQt.AlignVCenter )
self.connect( self.pb, SIGNAL("clicked()"), self.button1Clicked )
TQToolTip.add( self.pb, "push button 1" )
self.pm = TQPixmap()
- self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2
+ self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2
if not self.pix:
TQMessageBox.information( None, "TQt Widgets Example",
"Could not load the file \"qt.png\", which\n"
@@ -224,7 +224,7 @@ class WidgetView ( TQWidget ):
self.vbox.addSpacing( self.bg.fontMetrics().height() )
- self.cb = range(3)
+ self.cb = list(range(3))
self.cb[0] = TQCheckBox( self.bg )
self.cb[0].setText( "Read" )
self.vbox.addWidget( self.cb[0] )
@@ -466,20 +466,20 @@ class WidgetView ( TQWidget ):
self.msg.setText( txt )
if index == 0:
TQApplication.setWinStyleHighlightColor( TQt.darkBlue )
- elif index == 1:
+ elif index == 1:
TQApplication.setWinStyleHighlightColor( TQt.darkRed )
- elif index == 2:
+ elif index == 2:
TQApplication.setWinStyleHighlightColor( TQt.darkGreen )
- elif index == 3:
+ elif index == 3:
TQApplication.setWinStyleHighlightColor( TQt.blue )
- elif index == 4:
+ elif index == 4:
TQApplication.setWinStyleHighlightColor( TQt.red )
def lineEditTextChanged( self, newText ):
- self.msg.setText("Line edit text: " + unicode(newText))
+ self.msg.setText("Line edit text: " + str(newText))
def spinBoxValueChanged( self, valueText ):
- self.msg.setText("Spin box value: " + unicode(valueText))
+ self.msg.setText("Spin box value: " + str(valueText))
# All application events are passed throught this event filter.
# We're using it to display some information about a clicked
@@ -496,10 +496,10 @@ class WidgetView ( TQWidget ):
# txt = txt + TQObject.name()
# else:
# txt = txt + "<no name>"
- # identify_now = FALSE # don't do it in message box
+ # identify_now = FALSE # don't do it in message box
# TQMessageBox.message( "Identify Widget", txt, 0, TQObject )
- # identify_now = TRUE; # allow it again
- # return FALSE # don't eat event
+ # identify_now = TRUE; # allow it again
+ # return FALSE # don't eat event
################################################################################################