本文整理匯總了Python中GUI.init方法的典型用法代碼示例。如果您正苦於以下問題:Python GUI.init方法的具體用法?Python GUI.init怎麽用?Python GUI.init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GUI
的用法示例。
在下文中一共展示了GUI.init方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: start
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import init [as 別名]
def start(argv):
graphics.assetDirectory('assets')
sprite = graphics.Sprite("sprite.png", Vector2D(100.0,100.0), frames=9)
button = GUI.Button("button.png", Vector2D(200.0,100.0))
def drawFunc():
sprite.draw()
button.draw()
graphics.drawText("Works!", Vector2D(80.0,550.0), Color(0,0,255))
graphics.init(800, 600, drawFunc)
inputf.init()
GUI.init()
def movementMicrothread():
while True:
if inputf.keyboard[inputf.key.UP]:
sprite.position.y += 10 * logic.delta()
if inputf.mouse.left:
sprite.position.x += 10 * logic.delta()
#else:
# sprite.position.x -= 10 * logic.delta()
if inputf.mouse.inRect(sprite):
sprite.position.y -= 10 * logic.delta()
microthreads.schedule()
microthreads.microthread(movementMicrothread)
logic.start()
示例2: on_init
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import init [as 別名]
def on_init(self, controller):
print "Initialized"
self.circleCount = 0;
self.window = None;
self.menu = None;
self.menu_window = None;
GUI.init()
示例3:
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import init [as 別名]
import pygame, GUI
pygame.init()
skin = GUI.Skin("Normal.png", "Over.png", "Down.png", pygame.font.Font(None, 14), 3)
skin_large = GUI.Skin("Over.png", "Normal.png", "Down.png", pygame.font.Font(None, 11), 1)
screen = GUI.init((400, 400), skin)
selection = 0
txt_on = False
txt_field = "Hi!"
running = True
while running:
GUI.Clear(screen, pygame.Color("Black"))
i = 0
while i <= 13:
GUI.Box(pygame.Rect(25*i, 0, 25, 25), "")
i += 1
if (GUI.Button(pygame.Rect(325, 0, 50, 25), "QUIT")):
running = False
if (GUI.RepeatButton(pygame.Rect(0, 25, 400, 25), "Long Button")):
GUI.Box(pygame.Rect(0, 50, 50, 350), "")
selection = GUI.SelectionGrid(pygame.Rect(25, 50, 375, 300), 3, selection, ["1", "2", "3", "4", "5", "6"])
txt_field, txt_on = GUI.TextField(pygame.Rect(25, 375, 375, 25), txt_field, txt_on, skin_large)
pygame.display.flip()
for event in pygame.event.get():
if (event == pygame.QUIT):
running = False
pygame.time.wait(60)
pygame.quit()
示例4:
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import init [as 別名]
#! /bin/usr/env python3.4
# Подключение модулей
import ConfigFile, DB, GUI
win=None # Окно
# 1 шаг - инициализация
app=GUI.init() # Приложение
# 2 шаг - предварительная загрузка настроек
configs=None
try:
configs=ConfigFile.read("config.json")
except ConfigFile.ConfigFileOpenError:
answer=GUI.messageDialog(title="Приветствие",\
text="Хотите настроить подключение к базе данных?", yes="Да",\
no="Нет, продолжить без подключения", cancel="Нет, выйти")
if answer==-1:
win=GUI.MainWindow()
win.show()
elif answer==0:
exit(0)
else:
win=GUI.SetupDatabaseWindow()
win.show()
except (ConfigFile.ConfigFileNotJSONError,\
ConfigFile.ConfigFileInterruptError):
answer=GUI.messageDialog(title="Ошибка",\
text="Конфигурационный файл повреждён. Настроить заново?",\
yes="Да", no="Нет, продолжить без настройки",\
示例5: init
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import init [as 別名]
def init():
GUI.init()