def init(name=' ', window_size=(480, 320)): pygame.init() global window_surface window_surface = pygame.display.set_mode(window_size) pygame.display.set_caption(name) window.rect = pygame.Rect((0, 0), window_size) theme.init()
def init(name='', window_size=(640, 480)): logger.debug('init %s %s' % (__name__, __version__)) pygame.init() logger.debug('pygame %s' % pygame.__version__) pygame.key.set_repeat(200, 50) global window_surface window_surface = pygame.display.set_mode(window_size) pygame.display.set_caption(name) window.rect = pygame.Rect((0, 0), window_size) theme.init()
def run(): try: parser.init() stage.init() graphics.init() theme.init() gameloop.start() except KeyboardInterrupt: exit()
def run(): try: # Init the editor graphics.init() theme.init() # Start the editor gameloop.start() except KeyboardInterrupt: exit()
def init(name=' ', window_size=(480, 320), mouse=True, fullscreen=False): pygame.init() pygame.font.init() global window_surface if fullscreen: window_surface = pygame.display.set_mode(window_size, FULLSCREEN) else: window_surface = pygame.display.set_mode(window_size) pygame.display.set_caption(name) window.rect = pygame.Rect((0, 0), window_size) theme.init() pygame.mouse.set_visible(mouse) os.system("/home/pi/backlight.sh setup")
def run(): try: # Init the game parser.init() # Check for editor if (parser.args.editor): os.system("/usr/share/make-snake/snake-editor/__main__.py") sys.exit(0) graphics.init() theme.init() stage.init() game.reset() # Start the game gameloop.start() except KeyboardInterrupt: exit()
def __init__(self, parent): Frame.__init__(self, parent) self.sysstr = platform.system() self.attribute = { 'font': ('Monaco', 13), 'bg': "#1B1D1E", 'fg': "#F8F8F2", 'sl': False } print self.sysstr if self.sysstr == "Linux": self.attribute['font'] = ('Monaco', 13) self.attribute['chn'] = ('YHHT', 13) elif self.sysstr == "Windows": self.attribute['font'] = ('Simsun', 13) self.attribute['chn'] = ('Simsun', 13) elif self.sysstr == "Darwin": self.attribute['font'] = ('Monaco', 17) self.attribute['chn'] = ('STFangsong', 19) else: self.attribute['font'] = ('Monaco', 13) self.attribute['chn'] = ('Simsun', 14) self.menubar = Menu(parent, bg='#f0f0fa') self.fname = 'default.txt' # create file menu self.fmenu = Menu(self.menubar, tearoff=0) self.fmenu.add_command(label='Open', command=self.open) #fmenu.add_separator() self.fmenu.add_command(label='Save', command=self.save) self.fmenu.add_command(label='Exit', command=self.exit) self.menubar.add_cascade(label="File", menu=self.fmenu) # create edit menu editmenu = Menu(self.menubar, tearoff=0) editmenu.add_command(label='Chinese', command=self.modeCHN) editmenu.add_command(label='English', command=self.modeENG) self.menubar.add_cascade(label='Edit', menu=editmenu) # create help menu helpmenu = Menu(self.menubar, tearoff=0) helpmenu.add_command(label='About The Author', command=self.aboutAuthor) self.menubar.add_cascade(label='Help', menu=helpmenu) parent['menu'] = self.menubar # Text config self.text = Text(parent.Frame, font=self.attribute['font'], bg=self.attribute['bg'], fg=self.attribute['fg'], insertwidth=1, insertbackground="#f0f0f0", relief=FLAT, bd=0, pady=5, padx=5) self.text['tabs'] = '0.55i' self.text.configure(highlightthickness=0) self.linbar = Label(parent.Frame, width=3, pady=5, padx=5, font=self.text['font'], bg='#0a0a00', fg='#f0f0ff', anchor=NE) self.scrollbar = Scrollbar(parent.Frame) self.text['yscrollcommand'] = self.scrollbar.set self.scrollbar['command'] = self.text.yview self.linbar.pack(side=LEFT, fill=Y) self.text.pack(side=LEFT, fill=BOTH, expand=YES) self.scrollbar.pack(side=LEFT, fill=Y) self.TotalTextLine = 0 self.TotalWinLine = self.text.winfo_height() theme.init(self.text) # bind keys self.text.bind("<Control-a>", self.sel_all) self.text.bind("<Control-s>", self.save) self.filecontent = None