本文整理汇总了Python中ugfx.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: drawui
def drawui():
ugfx.init()
buttons.init()
ugfx.clear(ugfx.html_color(0x87F717))
ugfx.set_default_font(ugfx.FONT_MEDIUM)
ugfx.fill_circle(50,50, 20, ugfx.WHITE)
ugfx.fill_circle(50, 100, 20, ugfx.WHITE)
ugfx.text(45, 45, "A", ugfx.RED)
ugfx.text(45, 95, "B", ugfx.RED)
ugfx.text(95, 45, "Flash the lights", ugfx.WHITE)
ugfx.text(95, 95, "Disco Inferno", ugfx.WHITE)
ugfx.fill_polygon(270,50, [ [0,0], [40,0], [40, 175], [0, 175] ], ugfx.RED)# , [230, 100], [230, 60]
ugfx.fill_polygon(270,50, [ [0,0], [-20,10], [-20, 50], [0, 40] ], ugfx.RED)# , [230, 100], [230, 60]
ugfx.area(283, 61, 14, 10, ugfx.WHITE)
ugfx.area(283, 79, 14, 10, ugfx.WHITE)
ugfx.area(283, 97, 14, 10, ugfx.WHITE)
ugfx.area(283, 115, 14, 10, ugfx.WHITE)
ugfx.area(283, 133, 14, 10, ugfx.WHITE)
ugfx.area(283, 151, 14, 10, ugfx.WHITE)
ugfx.area(283, 169, 14, 10, ugfx.WHITE)
ugfx.area(283, 187, 14, 10, ugfx.WHITE)
开发者ID:davidcarboni,项目名称:emf2016-sign-badge,代码行数:27,代码来源:main.py
示例2: do_circle_of_life
def do_circle_of_life():
ugfx.init()
buttons.init()
buttons.disable_menu_reset()
colour = get_colour()
grid = Grid(ugfx.width(), ugfx.height(), colour_fore = colour, colour_back = COLOUR_BACK)
grid.randomise()
ugfx.clear(COLOUR_BACK)
hash_count = 0
hash_last = None
hash_last_last = None
while True:
# display
hash_val = grid.display_badge()
# randomise, if needed
if hash_val == hash_last_last:
hash_count += 1
if hash_count == HASH_COUNT_LIMIT:
colour = get_colour(colour)
grid.set_colour(colour)
grid.randomise()
hash_count = 0
else:
hash_count = 0
hash_last_last = hash_last
hash_last = hash_val
# process next generation
grid.next_generation()
grid.swap_cell_buffers()
# buttons
pyb.wfi()
if buttons.is_triggered("BTN_A") or buttons.is_triggered("BTN_B"):
colour = get_colour(colour)
grid.set_colour(colour)
grid.randomise()
if buttons.is_triggered("BTN_MENU"):
break
开发者ID:wamonite,项目名称:emfbadge_2016_life,代码行数:47,代码来源:main.py
示例3: elif
ugfx.backlight(100)
elif (l > 20):
ugfx.backlight(70)
else:
ugfx.backlight(30)
# Finds all locally installed apps that have an external.py
def get_external_hook_paths():
return ["%s/external" % app.folder_path for app in get_local_apps() if is_file("%s/external.py" % app.folder_path)]
def low_power():
ugfx.backlight(0)
ugfx.power_mode(ugfx.POWER_OFF)
ugfx.init()
imu=IMU()
neo = pyb.Neopix(pyb.Pin("PB13"))
neo.display(0x04040404)
ledg = pyb.LED(2)
ival = imu.get_acceleration()
if ival['y'] < 0:
ugfx.orientation(0)
else:
ugfx.orientation(180)
buttons.init()
if not onboard.is_splash_hidden():
splashes = ["splash1.bmp"]
for s in splashes:
开发者ID:farragar,项目名称:Mk3-Firmware,代码行数:31,代码来源:main.py
注:本文中的ugfx.init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论