[PyQt] Create a class to position a window on the screen.

Rohit Coder passionate_programmer at hotmail.com
Sun Jan 9 02:23:01 GMT 2011


Hi,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
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 code below is correctly written or not. I want to modify it further as:
 1. In the arguments, I want to pass the name of another opened Window (.py) on the screen. 2. I want to pass the x-coord., y-coord. and the name of the window to position on the screen.
How to modify the code to fulfill these requirements?
**Attempted Code**
    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)
...................Rohit.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110109/b30d3bd3/attachment-0001.html>


More information about the PyQt mailing list