PyQt4 рдореЗрдВ QGraphicsScene рдореЗрдВ рдЕрдкрдирд╛ рдмрдЯрди рдбреНрд░рд╛ рдХрд░реЗрдВ

рдРрд╕рд╛ рд▓рдЧрддрд╛ рд╣реИ рдХрд┐ рдпрд╣ рдЕрдкрдиреЗ рдорд╛рдирдХ рд╡реНрдпрд╡рд╣рд╛рд░ рдФрд░ рджреБрдирд┐рдпрд╛ рднрд░ рдореЗрдВ рдПрдХ рдкрд░рд┐рдЪрд┐рдд рдирдЬрд╝рд░ рдХреЗ рд╕рд╛рде рдПрдХ рдирд┐рдпрдорд┐рдд рдмрдЯрди рдХреА рддреБрд▓рдирд╛ рдореЗрдВ рд╕рд░рд▓ рд╣реЛ рд╕рдХрддрд╛ рд╣реИ? рд╣рд╛рд▓рд╛рдБрдХрд┐, рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рдмрдЯрди рдмрдирд╛рдиреЗ рдХреА рдкреНрд░рдХреНрд░рд┐рдпрд╛ PyQt4 рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдХреЗ рд╕рдВрдкреВрд░реНрдг рдЕрдиреБрдкреНрд░рдпреЛрдЧ рдмрдирд╛рдиреЗ рд╕реЗ рдХрдо рджрд┐рд▓рдЪрд╕реНрдк рдирд╣реАрдВ рд╣реИред

рдпрд╣рд╛рдБ QGraphicsWidget рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдХреЗ QGraphicsScene рдореЗрдВ рдЕрдкрдирд╛ рд╕реНрд╡рдпрдВ рдХрд╛ рд╣рд╛рде рд╕реЗ рддреИрдпрд╛рд░ рдмрдЯрди рдмрдирд╛рдиреЗ рдХрд╛ рдПрдХ рдЙрджрд╛рд╣рд░рдг рд╣реИред

PyQt4 рдХреЗ рд╕рд╛рде рдЕрдиреБрднрд╡ рд╡рд╛рд▓реЗ рд▓реЛрдЧреЛрдВ рдХреЗ рд▓рд┐рдП рдЕрдиреБрд╢рдВрд╕рд┐рдд рдкрдврд╝рдиреЗред

рд╕рдмрд╕реЗ рдкрд╣рд▓реЗ, рдЖрдЗрдП рдЬрд╛рдиреЗрдВ рдХрд┐ рдПрдХ рдмрдЯрди рдХреНрдпрд╛ рд╣реИред
рд╕рд╛рдорд╛рдиреНрдп рдмрдЯрди, рдЕрдХреНрд╕рд░, рдкрд╛рда рдФрд░ / рдпрд╛ рдПрдХ рддрд╕реНрд╡реАрд░ рдХреЗ рд╕рд╛рде рдПрдХ рдЖрдпрдд, рдПрдХ рдорд╛рдЙрд╕ рдХреНрд▓рд┐рдХ рд╣реЛрддрд╛ рд╣реИ, рдЬрд┐рд╕ рдкрд░ рдПрдХ рджреГрд╢реНрдп рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛ рд╣реЛрддреА рд╣реИред рдмрдЯрди рдХрд╛ рдореБрдЦреНрдп рдЙрджреНрджреЗрд╢реНрдп рдЗрд╕ рдмрдЯрди рдХреЗ рд╕рдордиреНрд╡рдп рдХреНрд╖реЗрддреНрд░ рдореЗрдВ рд╕реНрдерд┐рдд рдорд╛рдЙрд╕ рдкреЙрдЗрдВрдЯрд░ (рдпрд╛ рдЙрдВрдЧрд▓реА) рдХреЗ рд╕рд╛рде рджрдмрд╛рдиреЗ рдФрд░ рдорд╣рд╕реВрд╕ рдХрд░рдиреЗ рдХреА рдПрдХ рд╕рд░рд▓ рдШрдЯрдирд╛ рдХрд╛ рдЬрд╡рд╛рдм рджреЗрдирд╛ рд╣реИред

  1. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  2. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  3. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  4. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  5. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  6. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  7. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  8. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  9. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  10. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  11. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  12. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  13. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  14. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  15. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  16. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  17. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  18. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  19. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  20. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  21. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  22. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  23. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  24. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  25. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  26. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  27. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  28. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  29. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  30. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  31. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  32. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  33. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  34. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  35. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  36. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  37. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  38. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  39. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  40. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  41. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  42. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  43. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  44. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  45. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  46. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  47. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  48. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  49. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  50. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  51. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  52. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  53. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  54. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  55. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  56. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  57. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  58. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  59. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  60. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  61. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  62. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  63. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  64. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  65. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  66. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  67. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  68. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  69. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  70. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  71. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())
  72. # -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import sys class AButton(QtGui.QGraphicsWidget): # mouse_isPressed = False def __init__ ( self , parent = None ): QtGui.QGraphicsWidget. __init__ ( self ) def boundingRect( self ): # # # # . # QRectF, QRect, # . return QtCore.QRectF( 0 , 0 , 40 , 40 ) def paint( self , painter, option, widget = 0 ): # opt = QtGui.QStyleOptionButton() # , # opt.state = ((QtGui.QStyle.State_Sunken if self .mouse_isPressed else QtGui.QStyle.State_Raised) | QtGui.QStyle.State_Enabled) # opt.text = self .text() # opt.icon = self .icon() # opt.rect = option.rect # opt.palette = option.palette # QtGui.QApplication.style().drawControl(QtGui.QStyle.CE_PushButton, opt, painter) def text( self ): # , , # return QtCore.QString( "hi" ) def icon( self ): # , # # QPixmap QIcon return QtGui.QIcon() def mousePressEvent( self , event): # # self .mouse_isPressed = True self .update() def mouseReleaseEvent( self , event): # self .mouse_isPressed = False # update - , # self .update() if __name__ == "__main__" : app = QtGui.QApplication( sys .argv) # , # scene = QtGui.QGraphicsScene() # button = AButton() # scene.addItem(button) # , # view = QtGui.QGraphicsView(scene) # view.setRenderHint(QtGui.QPainter.Antialiasing) # view.resize( 200 , 100 ) # view.setBackgroundBrush(QtGui.QApplication.palette().background()) view.show() sys .exit(app.exec_())



рдореЗрд░реЗ рдорд╛рдорд▓реЗ рдореЗрдВ, рдкрд╛рдпрдерди 2.7 рдХреЗ рд▓рд┐рдП рдпрд╣ рдХреЛрдб PyQt 4.9.1 рдореЗрдВ рдареАрдХ рд╕реЗ рдХрд╛рдо рдХрд░рддрд╛ рд╣реИред

рдмреЗрд╢рдХ, рдпрд╣ рдмрдЯрди рдПрдХрджрдо рд╕рд╣реА рд╣реИ, рд▓реЗрдХрд┐рди рд╣рдорд╛рд░рд╛ рд▓рдХреНрд╖реНрдп рдпрд╣ рд╕рдордЭрдирд╛ рдерд╛ рдХрд┐ рдЧреНрд░рд╛рдлрд┐рдХреНрд╕ рдХреНрд╖реЗрддреНрд░ рдореЗрдВ рд╣рдорд╛рд░реЗ рд╡рд┐рдЬреЗрдЯ рдХреИрд╕реЗ рдмрдирд╛рдПрдВ рдФрд░ рдЙрдиреНрд╣реЗрдВ рдЗрдВрдЯрд░реИрдХреНрдЯрд┐рд╡ рдХреИрд╕реЗ рдмрдирд╛рдПрдВред рд╕рд╛рдорд╛рдиреНрдп рддреМрд░ рдкрд░, рдпреЗ рдореВрд▓ рдмрд╛рддреЗрдВ рд╣реИрдВ, рдЬрд┐рдирдореЗрдВ рд╕реЗ рд╢реБрд░реВ рдХрд░рдирд╛ рдФрд░ рдЙрдиреНрд╣реЗрдВ рдмрджрд▓рдирд╛, рдЖрдк рдЕрдкрдиреЗ рд╡рд┐рдЪрд╛рд░реЛрдВ рдХреА рд▓рдЧрднрдЧ рдХрд┐рд╕реА рднреА рдкреНрд░рд╛рдкреНрддрд┐ рдХреЛ рдкреНрд░рд╛рдкреНрдд рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ рдФрд░ рдкреНрд░реЛрдЧреНрд░рд╛рдорд░ рдХреЗ рд░реВрдк рдореЗрдВ рдЕрдкрдиреЗ рдХрд╛рдо рдХрд╛ рдЕрднреНрдпрд╛рд╕ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред

рдкреНрд░рд╛рд░рдВрдн рдореЗрдВ, рдЗрдВрдЯрд░рдиреЗрдЯ рдкрд░ рдЙрдкрд░реЛрдХреНрдд рдХреЛрдб C ++ рдореЗрдВ рд▓рд┐рдЦрд╛ рдЧрдпрд╛ рдерд╛, рдЬрд┐рд╕реЗ рдХрдВрдкреНрдпреВрдЯрд░ рдкрд░ рд╕реБрд░рдХреНрд╖рд┐рдд рд░реВрдк рд╕реЗ рд╕рдВрдЧреНрд░рд╣реАрдд рдХрд┐рдпрд╛ рдЧрдпрд╛ рдерд╛, рдФрд░ рд╕реНрд░реЛрдд рдЦреЛ рдЧрдпрд╛ рдерд╛ред рдмрд╛рдж рдореЗрдВ, рдкрд╛рдпрдерди рдореЗрдВ рдХреБрдЫ рд╡рд┐рд╢реЗрд╖рддрд╛рдУрдВ рдХреЗ рд╕рд╛рде рдХреЛрдб рдХреЛ рдлрд┐рд░ рд╕реЗ рд▓рд┐рдЦрд╛ рдЧрдпрд╛, рдФрд░ рдореВрд▓ рдХреЛ рдХрдВрдкреНрдпреВрдЯрд░ рд╕реЗ рд╣рдЯрд╛ рджрд┐рдпрд╛ рдЧрдпрд╛ред

рдЖрдкрдХрд╛ рдзреНрдпрд╛рди рджреЗрдиреЗ рдХреЗ рд▓рд┐рдП рдзрдиреНрдпрд╡рд╛рджред

Source: https://habr.com/ru/post/In139933/


All Articles