Centering a window
Rohit Coder
passionate_programmer at hotmail.com
Mon Jan 10 17:37:35 EST 2011
I am using PyQt4 for GUI apps.
I created a class that contains a function to center any window (Form) whose name is passed to this class. I have two questions:
How to modify the below given code to center the window whose name we passed as an argument.How to pass window name to this class from another file that imports this class?
============= CODE BLOCK STARTS HERE ===========from PyQt4 import QtGui
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)============= CODE BLOCK ENDS HERE ===========
................Rohit K.elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110111/412470ff/attachment.html>
More information about the Python-list
mailing list