当前位置: 首页>>代码示例>>Python>>正文


Python Dialog.addComponent方法代码示例

本文整理汇总了Python中dialogs.Dialog.addComponent方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.addComponent方法的具体用法?Python Dialog.addComponent怎么用?Python Dialog.addComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dialogs.Dialog的用法示例。


在下文中一共展示了Dialog.addComponent方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: showAlert

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def showAlert(button):
   alert = Dialog("Alert", 40, 6, dialogs.ALERT_DIALOG_DECO)
   bOk = Button(1, "Ok", dialogs.ALERT_BUTTON_DECO)
   alert.addComponent(Label("Press 'Ok' button to close alert dialog.", 38), 1, 2)
   alert.addComponent(bOk, 31, 4)
   alert.center()

   def ok(button):
      alert.destroy()
      dialog.focus()
  
   bOk.setCallback(ok)
   dialog.unfocus()
   alert.draw()
   alert.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:17,代码来源:example3.py

示例2: start

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def start(button):
   progressDialog = Dialog("", 40, 5)
   progress = Progressbar(38, 0, 10)
   progressDialog.addComponent(progress, 1, 2)
   progressDialog.center()

   dialog.unfocus()
   progressDialog.draw()
   progressDialog.focus()

   for i in range(1, 11):
      time.sleep(0.5)
      progress.setValue(i)
   time.sleep(0.5)

   progressDialog.destroy()
   dialog.focus() 
开发者ID:statgen,项目名称:dialogs,代码行数:19,代码来源:example4.py

示例3: ok

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   label.setText("Entered: " + "".join(cmbPath.text))

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:20,代码来源:example8.py

示例4: ok

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   value = dropdown.getValue()
   label.setText("Selected: " + value['label'] + " (" + value['value'] + ")")

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:21,代码来源:example9.py

示例5: ok

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   selected = []
   for i in xrange(0, len(checkbox)):
      if checkbox[i].checked:
         selected.append(i + 1)

   label.setText("Selected: " + str(selected))

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
开发者ID:statgen,项目名称:dialogs,代码行数:25,代码来源:example6.py

示例6: cancel

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
   alert.focus()
   
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 10)
      bShowAlert = Button(1, "Alert")
      bCancel = Button(2, "Cancel")
      bShowAlert.setCallback(showAlert)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Press 'Alert' button to show alert dialog.", 58), 1, 2)
      dialog.addComponent(bShowAlert, 36, 8)
      dialog.addComponent(bCancel, 47, 8)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:32,代码来源:example3.py

示例7: cancel

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
   dialogs.stop()

def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog1 = Dialog("Dialog 1", 60, 8)
      bNext1 = Button(1, "Next")
      bCancel1 = Button(2, "Cancel")
      bNext1.setCallback(next)
      bCancel1.setCallback(cancel)
      dialog1.addComponent(bNext1, 37, 6)
      dialog1.addComponent(bCancel1, 47, 6)
      dialog1.center()

      dialog2 = Dialog("Dialog 2", 60, 8)
      bFinish2 = Button(1, "Finish")
      bBack2 = Button(2, "Back")
      bCancel2 = Button(3, "Cancel")
      bFinish2.setCallback(finish)
      bBack2.setCallback(back)
      bCancel2.setCallback(cancel)
      dialog2.addComponent(bFinish2, 25, 6)
      dialog2.addComponent(bBack2, 37, 6)
      dialog2.addComponent(bCancel2, 47, 6)
      dialog2.center()
开发者ID:statgen,项目名称:dialogs,代码行数:32,代码来源:example1.py

示例8: Dialog

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 40, 12)
      cmbPath = Combobox(1, 36)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      cmbPath.setPopupCallback(path)
      cmbPath.setPopupWidth(60)
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Enter file path (TAB for autocomplete) and press 'Ok' button:", 38), 1, 2)
      dialog.addComponent(cmbPath, 2, 5)
      dialog.addComponent(bOk, 19, 10)
      dialog.addComponent(bCancel, 27, 10)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:32,代码来源:example8.py

示例9: ok

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
def ok(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 14)
      bMore = Button(1, "More")
      bOk = Button(2, "Ok")
      label = Label("Python is a computer programming language that lets you work more quickly than other programming languages."
                    "Experienced programmers in any other language can pick up Python very quickly, and beginners find the clean syntax and indentation structure easy to learn.\n\n"
                    "From http://pythonprogramminglanguage.com web page.", 58)
      bMore.setCallback(more)
      bOk.setCallback(ok)
      dialog.addComponent(label, 1, 2)
      dialog.addComponent(bMore, 41, 12)
      dialog.addComponent(bOk, 51, 12)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:32,代码来源:example2.py

示例10: Dialog

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 50, 12)
      for i in xrange(0, len(checkbox)):
         checkbox[i] = Checkbox(i, "Option " + str(i + 1), 48)
         checkbox[i].setCallback(check)
      bOk = Button(4, "Ok")
      bCancel = Button(5, "Cancel")
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Select single option and press 'Ok' button:", 48), 1, 2)
      for i in xrange(0, len(checkbox)):
         dialog.addComponent(checkbox[i], 1, i + 4)
      dialog.addComponent(bOk, 29, 10)
      dialog.addComponent(bCancel, 37, 10)
      dialog.center()

      checkbox[0].check()
      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
开发者ID:statgen,项目名称:dialogs,代码行数:33,代码来源:example6.py

示例11: cancel

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 12)
      txtInput = Textfield(1, 58)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Enter text and press 'Ok' button:", 58), 1, 2)
      dialog.addComponent(txtInput, 1, 4)
      dialog.addComponent(bOk, 39, 10)
      dialog.addComponent(bCancel, 47, 10)
      dialog.center()

      txtInput.setText("default text")
      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:33,代码来源:example7.py

示例12: xrange

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
if __name__ == '__main__':
   try:
      items = [{"label": "Option {}".format(i), "value": "Value {}".format(i)} for i in xrange(1,35)]

      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 52, 8)
      dropdown = Dropdown(1, items, 12)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      dropdown.setPopupWidth(10)
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Select option and press 'Ok' button:", 38), 1, 2)
      dialog.addComponent(dropdown, 38, 2)
      dialog.addComponent(bOk, 31, 6)
      dialog.addComponent(bCancel, 39, 6)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:31,代码来源:example9.py

示例13: cancel

# 需要导入模块: from dialogs import Dialog [as 别名]
# 或者: from dialogs.Dialog import addComponent [as 别名]
   progressDialog.destroy()
   dialog.focus() 
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 9)
      bStart = Button(1, "Start")
      bCancel = Button(2, "Cancel")
      bStart.setCallback(start)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Press 'Start' button to show progress bar.", 58), 1, 2)
      dialog.addComponent(bStart, 36, 7)
      dialog.addComponent(bCancel, 47, 7)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
开发者ID:statgen,项目名称:dialogs,代码行数:32,代码来源:example4.py


注:本文中的dialogs.Dialog.addComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。