本文整理汇总了Python中gui.Gui.showMessage方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.showMessage方法的具体用法?Python Gui.showMessage怎么用?Python Gui.showMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.showMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import showMessage [as 别名]
class Main():
def __init__(self, GUI, DEBUG, fps, stick_sens, saveFile):
self.GUI = GUI
self.DEBUG = DEBUG
self.max_fps = fps
self.stick_sens = stick_sens
self.saveFile = saveFile
pygame.init()
self.clock = pygame.time.Clock()
self.run = True
self.started = False
self.main_throttle = 0
self.throttle = [0,0,0,0]
self.holdPosition = 0
self.holdHeight = 0
self.isGamepad = 1
self.gamepad = Gamepad()
self.gamepad_axes = [0,0,0]
self.gamepad_throttle = 0
self.bno = BNO()
self.m1 = Motor(15)
self.m2 = Motor(27)
self.m3 = Motor(10)
self.m4 = Motor(7)
self.motors = [self.m1, self.m2, self.m3, self.m4]
if self.GUI:
self.gui = Gui()
if self.GUI:
self.gui.showMessage("Press 'start'-Button to start!")
if self.DEBUG:
# Print system status and self test result.
status, self_test, error = self.bno.get_system_status()
print("DEBUG: System status: {0}".format(status))
print("DEBUG: Self test result (0x0F is normal): 0x{0:02X}".format(self_test))
# Print out an error if system status is in error mode.
if status == 0x01:
print("DEBUG: System error: {0}".format(error))
print("DEBUG: See datasheet section 4.3.59 for the meaning.")
# Print BNO055 software revision and other diagnostic data.
sw, bl, accel, mag, gyro = self.bno.get_revision()
print("DEBUG: Software version: {0}".format(sw))
print("DEBUG: Bootloader version: {0}".format(bl))
print("DEBUG: Accelerometer ID: 0x{0:02X}".format(accel))
print("DEBUG: Magnetometer ID: 0x{0:02X}".format(mag))
print("DEBUG: Gyroscope ID: 0x{0:02X}\n".format(gyro))
self.load()
if self.DEBUG:
print("DEBUG: READY!")
self.loop()
def eventHandler(self):
for event in pygame.event.get():
if event.type == QUIT:
if self.DEBUG:
print("DEBUG: SHUTDOWN")
pygame.quit()
if self.GUI:
curses.endwin()
sys.exit()
elif event.type == JOYBUTTONDOWN:
self.gamepad.handleButtonDown(event.button)
elif event.type == JOYBUTTONUP:
self.gamepad.handleButtonUp(event.button)
def getGamepadValues(self):
self.gamepad_throttle = self.gamepad.getThrottle()
self.gamepad_axes = self.gamepad.getAxis()
def checkCalibButtons(self):
if self.gamepad.isSave:
if self.DEBUG:
print("DEBUG: Save Calibration-Data")
self.save()
if self.DEBUG:
print("DEBUG: Data saved")
if self.gamepad.isCalib:
if self.DEBUG:
print("DEBUG: calibrate BNO")
self.bno.calibrateBNO()
if self.DEBUG:
#.........这里部分代码省略.........