Guest User

Untitled

a guest
Jun 18th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. from PySide.QtGui import *
  2. from PySide.QtCore import *
  3. import sys
  4.  
  5. def getPalette():
  6.     palette = QPalette()
  7.    
  8.     brush = QBrush(QColor(80, 80, 80))
  9.     brush.setStyle(Qt.SolidPattern)
  10.     palette.setBrush(QPalette.Active, QPalette.Button, brush)
  11.    
  12.     # THIS SETS THE FONT TO WHITE ON WINDOWS BUT NOT ON OSX
  13.     brush = QBrush(QColor(255, 255, 255))
  14.     brush.setStyle(Qt.SolidPattern)
  15.     palette.setBrush(QPalette.Active, QPalette.BrightText, brush)
  16.    
  17.     return palette
  18.  
  19. def getStyleSheet():
  20.     return """
  21. QPushButton{
  22. background-color: rgb(80, 80, 80);
  23. }
  24.  
  25. QPushButton:active{
  26. color: rgb(255, 255, 255);
  27. }
  28.    """
  29.  
  30. app = QApplication( sys.argv )
  31. app.setStyle( 'plastique' )
  32. app.setStyleSheet( getStyleSheet() )
  33.  
  34. w = QWidget()
  35. b = QPushButton( 'test' )
  36. w.setLayout( QHBoxLayout() )
  37. w.layout().addWidget( b )
  38.  
  39. w.show()
  40. sys.exit( app.exec_() )
Advertisement
Add Comment
Please, Sign In to add comment