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


Python Dialog.dselect方法代码示例

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


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

示例1: float

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import dselect [as 别名]
                try:
                    x = float(answers[1][0])
                    y = float(answers[1][1])
                    z = float(answers[1][2])
                    pos = Position(x, y, z)
                    q = chargeUnit.multiplier()  # how much charge do you use?
                    par = (Particle(Position(x, y, z), q))
                    force = par.get_force()  # here's the error
                    d.msgbox(force.text())
                    del par  # keep memory usage low. Might be important for large projects/complex objects.
                    break
                except:
                    d.msgbox("All inputs must be numbers only.")

        elif tag == "Save":
            code, path = d.dselect("/", title="Choose a directory to save your file in:")
            if code != d.OK:
                break
            code, file = d.inputbox("Enter a file name:")
            if code != d.OK:
                break
            try:
                output_file = open(path+file, "w")
            except:
                print("Cannot open file.")
                break
            string = "<conditions>\n"
            for obj in objects:
                string += "    <particle>"
                string += "        <position>["+str(obj.position.x)+","+str(obj.position.y)+","+str(obj.position.z)+\
                          "]</position>"
开发者ID:idajourney,项目名称:PhysTools,代码行数:33,代码来源:main.py

示例2: get_info_via_dialog

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import dselect [as 别名]
def get_info_via_dialog():
    global server
    global username
    global password
    global user  # chmod user
    global cred_file
    global mount_folder
    global create_mount_fld_as_sharename
    global fstab_loc

    from dialog import Dialog
    d = Dialog(dialog="dialog")

    button_names = {d.OK: "OK",
                    d.CANCEL: "Cancel",
                    d.HELP: "Help",
                    d.EXTRA: "Extra"}


    code, tag = d.mixedform("What sandwich toppings do you like?",
                             [("Server", 1, 1, "",1, 10, 20, 20, 0),
                              ("Username", 2, 1, "",2, 10, 20, 20, 0),
                              ("Password", 3, 1, "", 3, 10, 20, 20, 1)
                              ]
                )
    import pprint
    pprint.pprint(code)
    pprint.pprint(tag[1])

    if tag[0] != '' and tag[1] != '' and tag[2] != '':
        server = tag[0]
        username = tag[1]
        password = tag[2]
    else:
        sys.exit("Please specify all the input box's")

    code, tag = d.inputbox("Please enter the username who will have R/W access to the mounts")

    pprint.pprint(code)
    pprint.pprint(tag)

    #need to add checks for user
    user = tag

    code, tag = d.inputbox("Please enter the filename only, it will be edited to add the username and password\n and will be user in fstab or mount cmd")
    if tag != '':
        cred_file = tag


    code, tag = d.fselect('/etc/fstab')
    if tag != '':
        fstab_loc = tag

    import pathlib

    code, tag = d.dselect('/media')
    if tag != '' and pathlib.Path(tag).is_dir():
        mount_folder = tag
    else:
        sys.exit("Please select a folder to mount!")

    pprint.pprint(code)
    pprint.pprint(tag)
开发者ID:vivekdave,项目名称:autoCifs,代码行数:65,代码来源:index.py


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