I am new to Python and this is my fist Python class. I am using PyQt4 framework on Windows 7.
I don't know whether the few lines of code below is correctly written or not. I want to modify it further as:
How to modify the code to fulfill these requirements?
Edited Further
class PositionWindow:
def __init__(self, xCoord, yCoord, windowName, parent = None):
self.x = xCoord
self.y = yCoord
self.wName = windowName;
def center(self):
screen = QtGui.QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
Can't you just use window.setGeometry(x_pos, y_pos, width, height)
? A class seem overkill in this case.
See here for documentation.
You can also use
def main():
app = QtGui.QApplication(sys.argv)
gui = Program()
gui.move(380, 170)
gui.show()
app.exec_()
the gui.move() will position your application to the stated coordinates in the parenthesis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With