from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QPushButton, QAction, QLineEdit, QMessageBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class Mainwindow(QMainWindow):
def __init__(self, parent=None):
super(Mainwindow,self).__init__(parent)
#how to make it auto fix the screen
self.resize(400,700)
#set title
self.setWindowTitle("垃圾侠")
#search box
searchbox=QLineEdit(self)
searchbutton=QPushButton(self)
#size and location control
searchbox.setGeometry(QtCore.QRect(80, 50, 220, 30))
searchbox.setText("请输入要查询的垃圾")
#注意这里,用CSS的方式来设置属性
searchbox.setStyleSheet()
searchbutton.setGeometry(QtCore.QRect(350, 50, 40, 30))
searchbutton.setText("查询")
if __name__=="__main__":
app=QApplication(sys.argv)
app.setWindowIcon(QIcon("C:\\python_work\\App_Android\\App_android\\data\\trash.ico"))
form=Mainwindow()
form.show()
sys.exit(app.exec_())