# -*- coding: cp936 -*-
import sys
from PyQt4 import QtGui
class Center(QtGui.QWidget):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.setWindowTitle(u‘在中间‘)
self.resize(250,150)
self.center()
def center(self):
screen=QtGui.QDesktopWidget().screenGeometry()
size=self.geometry()
self.move((screen.width()-size.width())/2,
(screen.height()-size.height())/2)
app=QtGui.QApplication(sys.argv)
qb=Center()
qb.show()
sys.exit(app.exec_())
IMG
时间: 2024-10-20 15:10:01