本文整理汇总了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>"
示例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)