示例#1
0
文件: boxes.py 项目: socek/Menu-Gui
class InfoBox(Window):
    def __init__(self, title, text, *args, **kwargs):
        super(InfoBox, self).__init__(title, *args, **kwargs)
        texts = text.split('\n')
        for text in texts:
            self._data.append((text, 0))
        self._data.append(('', 0))
        
        button_text = u'ok'
        button_width = len(button_text) + 2
        button_margin = (self.width / 2) - (button_width / 2) 
        
        self.button = Button(self, self.height-2, button_margin, button_text, button_width, self.peacful_close)
        self.button.set_active(True)
        self.button.set_highlited(True)
        
        self.run()
    
    def run(self):
        self._running = True
        self.set_active(True)
        
        self.refresh()
        while self._running:
            self.button.processed_character()
        
        self.close()
    
    def peacful_close(self, *args, **kwargs):
        self._running = False
示例#2
0
文件: boxes.py 项目: socek/Menu-Gui
 def __init__(self, title, text, *args, **kwargs):
     super(InfoBox, self).__init__(title, *args, **kwargs)
     texts = text.split('\n')
     for text in texts:
         self._data.append((text, 0))
     self._data.append(('', 0))
     
     button_text = u'ok'
     button_width = len(button_text) + 2
     button_margin = (self.width / 2) - (button_width / 2) 
     
     self.button = Button(self, self.height-2, button_margin, button_text, button_width, self.peacful_close)
     self.button.set_active(True)
     self.button.set_highlited(True)
     
     self.run()