本文整理汇总了Python中options.Options.height方法的典型用法代码示例。如果您正苦于以下问题:Python Options.height方法的具体用法?Python Options.height怎么用?Python Options.height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类options.Options
的用法示例。
在下文中一共展示了Options.height方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_events
# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import height [as 别名]
def handle_events(self):
""" Handle any pygame event """
opt = Options()
# pygame logic
for event in pygame.event.get():
if event.type == QUIT:
return Event.DONE
elif event.type == VIDEORESIZE:
self.screen = pygame.display.set_mode(event.dict['size'], RESIZABLE)
opt.width = event.dict["w"]
opt.height = event.dict["h"]
self.__reflow()
pygame.display.flip()
elif event.type == MOUSEMOTION:
if pygame.mouse.get_focused():
pos = pygame.mouse.get_pos()
self.select_item_on_hover(*pos)
elif event.type == KEYDOWN:
if event.key == K_UP and pygame.key.get_mods() & KMOD_CTRL and opt.read_from_server:
opt.read_delay += 1
self.update_window_title()
elif event.key == K_DOWN and pygame.key.get_mods() & KMOD_CTRL and opt.read_from_server:
opt.read_delay = max(0, opt.read_delay - 1)
self.update_window_title()
elif event.key == K_RETURN:
self.load_selected_detail_page()
elif event.key == K_F4 and pygame.key.get_mods() & KMOD_ALT:
return Event.DONE
elif event.key == K_c and pygame.key.get_mods() & KMOD_CTRL:
# Debug function to write the state to a json file
#with open("../export_state.json", "w") as state_file:
# state_file.write(json.dumps(self.state, cls=TrackerStateEncoder, sort_keys=True))
# Write the seed to the clipboard
# (from http://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python)
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append(self.state.seed)
r.destroy()
#self.generate_run_summary() # This is commented out because run summaries are broken with the new "state" model rewrite of the item tracker
elif event.type == MOUSEBUTTONDOWN:
if event.button == 1:
self.load_selected_detail_page()
if event.button == 3:
self.save_window_position()
import option_picker
self.screen.fill(DrawingTool.color(opt.background_color))
self.write_message("Editing options...", flip=True)
pygame.event.set_blocked([QUIT, MOUSEBUTTONDOWN, KEYDOWN, MOUSEMOTION])
option_picker.OptionsMenu().run()
pygame.event.set_allowed([QUIT, MOUSEBUTTONDOWN, KEYDOWN, MOUSEMOTION])
self.reset_options()
self.reset()
if self.state is not None:
self.__reflow()
return Event.OPTIONS_UPDATE
return None