5. PNG
The from PyQt5. QtWidgets import QWidget, QApplication QPushButton, QHBoxLayout
The from PyQt5. QtGui import QPixmap, QCursor
The from PyQt5. QtCore import Qt
The import sys
The class Button (QPushButton) :
Def __init__ (self) :
Super () __init__ ()
Self. Pix=QPixmap (" 5. PNG ")
The self. The pix=self. Pix. Three (100, 100)
Self. SetMask (self. Pix. Mask ())
Self. SetFixedSize (self. Pix. The size ()
Self. SetStyleSheet (" background - image: url (5. PNG) ")
The class WinForm (QWidget) :
Def __init__ (self) :
Super () __init__ ()
The self. The initUI ()
Def initUI (self) :
Self. SetFixedSize (400, 300)
The self. The layout=QHBoxLayout ()
Self. SetLayout (self. Layout)
The self. The BTN=Button ()
The self. The BTN. SetObjectName (" BTN ")
Self. Layout. AddWidget (self BTN)
The self. The BTN. SetStyleSheet (" # BTN {background - color: # FFF; }
")Self. SetStyleSheet (" background - color: # 666;" )
# self. Btn1=QPushButton ()
# self. Btn1. SetFixedSize (50, 50)
# self. Btn1. SetObjectName (" btn1 ")
# self. Layout. AddWidget (self btn1)
# # self. Btn1. SetStyleSheet (" btn1 {background - image: url (5. PNG); }
")
If __name__=="__main__ ':
App=QApplication (sys. Argv)
Win=WinForm ()
Win. The show ()
Sys. Exit (app. Exec_ ())
Effect:
Is the anti-alias
Please, god!!!!!!
CodePudding user response:
Your graphics card is GF MX 440?CodePudding user response:
Not showing the sawtooth with graphics card???????