Changeset 163

Show
Ignore:
Timestamp:
10/25/2004 12:47:13 PM (4 years ago)
Author:
mtigges
Message:

added the feature to centre the menu if -1,-1 is passed as the position
to the start function.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plwm/menu.py

    r119 r163  
    1 # $Id: menu.py,v 1.11 2002-03-02 08:30:35 mwm Exp $ 
     1# $Id: menu.py,v 1.12 2004-10-25 17:47:13 mtigges Exp $ 
    22# 
    33# menu.py -- Screen mixin to provide menus. 
     
    8282 
    8383    def start(my, x, y, action, handler, timeout = 0): 
    84         "Start it up..." 
     84        """Start it up... 
     85 
     86           Passing x,y = -1,-1 will cause the menu to be centred on the 
     87           screen. 
     88        """ 
     89 
     90        if x==-1 and y==-1: 
     91            x = my.wm.current_screen.root_width/2-my.width/2 
     92            y = my.wm.current_screen.root_height/2-my.height/2 
    8593 
    8694        Message.display(my, x, y, timeout)