Changeset 140

Show
Ignore:
Timestamp:
04/14/08 16:32:09 (6 months ago)
Author:
njriley
Message:

be friendlier for non-touchscreen users executing this script directly; try removing timeout ID in destroy too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sucrose/trunk/python/keypad_tk.py

    r139 r140  
    3737 
    3838                self.window = Tkinter.Tk() 
    39                 cursor_file = os.path.join(os.path.dirname(__file__), 'emptycursor.xbm') 
    40                 self.window.config(cursor='@%s white' % cursor_file) 
     39                if __name__ != '__main__': 
     40                        cursor_file = os.path.join(os.path.dirname(__file__), 
     41                                                                           'emptycursor.xbm') 
     42                        self.window.config(cursor='@%s white' % cursor_file) 
    4143                self.window.title('Sucrose') 
    4244                self.window.geometry('800x600+0+0') 
     
    8284                self.view_buttons[view].config(relief=Tkinter.SUNKEN) 
    8385                view.grid(row=1, column=0) 
    84                 self.reset_idle_timeout() 
     86                if __name__ != '__main__': 
     87                        self.reset_idle_timeout() 
    8588 
    8689 
     
    9093                for i in self.view_names: 
    9194                        getattr(self,i).destroy() 
     95                if hasattr(self, 'timeout_id'): 
     96                        self.window.after_cancel(self.timeout_id) 
    9297                self.window.destroy() 
    9398                del self.window