Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Author: Fangjie Chen
# Data: 2017-11-11
# 导入EasyGui模块
import easygui as eg
import sys
while True:
eg.msgbox("Hi,欢迎进入第一个界面小程序^_^")
msg = "请问你希望打开哪个功能选项呢?"
title = "EasyGuo小程序"
choices = ["Python入门", "Python进阶", "Python实战", "Python-AI"]
# 获得选择的结果
choice = eg.choicebox(msg, title, choices)
# 弹出对话框,显示选择的结果
eg.msgbox("你的选择是: "+ str(choice), "结果")
msg = "你希望重新开始小程序么?"
title = "请选择"
# 显示一个继续、取消对话框
if eg.ccbox(msg, title):
pass # 用户选择继续
else:
sys.exit(0) # 用户选择取消
def resolution_requester():
res_list = ["320x200", "640x400", "800x600", "1280x720", "1600x900", "1920x1080", "1920x1200"]
choice = easygui.choicebox(msg='Select your screen resolution', title='Screen Resolution', choices=(res_list))
if choice is not None:
demo_screen_size[0] = int(choice.split("x")[0])
demo_screen_size[1] = int(choice.split("x")[1])
else:
print 'all is well'
# Begin Interview using Easygui.
msg ="Which Workflow?"
title = "Workflows"
choices = ["Telecine One Light", "Scanning", "Audio Extraction", "bestlight", "Telecine Grade", "Tape Ingest 1", "Tape Ingest 2", "Tape Edit Suite 1", "Tape Edit Suite 2"]
workflow = choicebox(msg, title, choices)
# Forking path in order to get more accurate info depending on workflow
if workflow not in ("Telecine One Light", "bestlight", "Telecine Grade", "Audio Extraction", "Scanning"):
no_of_emptyfields = 16 #temp, this will be a variable.
msg ="Tape Deck?"
title = "Pick a name yo!"
choices = ["DVW-500P", "MiniDV-Something", "UVW-1400AP", "DVW-510P", "J-30", "J-H3", "UVW-1200P", "Unknown"]
deck = choicebox(msg, title, choices)
print deck
if deck == "DVW-A500P":
def deck_func(number):
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:role', 'Playback', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:manufacturer', 'Sony', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:modelName', 'DVW-A500P', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:signal', 'SDI', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:serialNumber', '10317', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:settings[1]', 'Timecode = Auto', revtmd_xmlfile)
if deck == "DVW-510P":
def deck_func(number):
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:role', 'Playback', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:manufacturer', 'Sony', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:modelName', 'DVW-A510p', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:signal', 'SDI', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:serialNumber', '11414', revtmd_xmlfile)
'''
-------------------------------------------------------------------------------
This script is for testing EasyGUI
-------------------------------------------------------------------------------
'''
# Separated namespace
import easygui as g
# Local functions
import dbquery
OPENINGMSG = "What would you like to look up?"
TITLE = "DB Query Application"
CHOICES = ["Department", "IP", "Hostname", "Device Type"]
CHOICE = g.choicebox(OPENINGMSG, TITLE, CHOICES)
if CHOICE == "Department":
department = g.enterbox("What is the dept you want to search for?", TITLE)
RDept = dbquery.querydept(department)
g.msgbox(RDept, TITLE)
elif CHOICE == "IP":
ip = g.enterbox("What is the ip you want to search for?", TITLE)
RIP = dbquery.queryip(ip)
g.msgbox(RIP, TITLE)
elif CHOICE == "Hostname":
hostname = g.enterbox("What is the hostname you want to search for?", TITLE)
RHost = dbquery.queryip(hostname)
g.msgbox(RHost, TITLE)
prn("\nContact list: " + '; '.join(recip))
# ******************************************************************
if args.subcommand in ['assist', 'gui']:
if not usegui:
print('running "prox assist" command which will guide you '
'through a number of choices, however no GUI is available')
return False
chce = []
msg = ("Running 'prox assist'! Please select from the list "
"below or 'Cancel' and run 'prox --help' for other options. "
"Example: 'prox new mybox1 mybox2 mybox3' will create "
"3 Linux machines.")
chce = easygui.choicebox(msg, __app__,['New linux machine',
'New docker host', 'New virtual machine', 'List machines',
'Start machine', 'Stop machine', 'Modify machine',
'Destroy machine'])
if not chce:
return False
if chce.startswith('New '):
args.subcommand = 'new'
if chce != "New linux machine":
uselxc = False
else:
msg = ("Please select the size of your machine. "
"Memory sizes are in MB, unless you add G "
"(e.g. 1G). Disk sizes are always in GB\n."
"Please start small, you can always resize."
if capture_interventions != None:
number2 = 2
for interventions in capture_interventions:
add_to_revtmd('//revtmd:codingProcessHistory[2]' + '/revtmd:settings' + '[' + str(number2) + ']' , interventions, revtmd_xmlfile)
number2 += 1
for settings in flashtransfer_settings:
add_to_revtmd('//revtmd:codingProcessHistory[2]' + '/revtmd:settings' + '[' + str(number2) + ']' , settings, revtmd_xmlfile)
number2 += 1
else:
print 'all is well'
# Begin Interview using Easygui.
msg ="Which Workflow?"
title = "Workflows"
choices = ["Telecine One Light", "Scanning", "Audio Extraction", "bestlight", "Telecine Grade", "Tape Ingest 1", "Tape Ingest 2", "Tape Edit Suite 1", "Tape Edit Suite 2"]
workflow = choicebox(msg, title, choices)
# Forking path in order to get more accurate info depending on workflow
if workflow not in ("Telecine One Light", "bestlight", "Telecine Grade", "Audio Extraction", "Scanning"):
no_of_emptyfields = 16 #temp, this will be a variable.
msg ="Tape Deck?"
title = "Pick a name yo!"
choices = ["DVW-500P", "MiniDV-Something", "UVW-1400AP", "DVW-510P", "J-30", "J-H3", "UVW-1200P", "Unknown"]
deck = choicebox(msg, title, choices)
print deck
if deck == "DVW-A500P":
def deck_func(number):
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:role', 'Playback', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:manufacturer', 'Sony', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:modelName', 'DVW-A500P', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:signal', 'SDI', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:serialNumber', '10317', revtmd_xmlfile)
else:
if workflow == "Scanning":
scanner = 'Scanner'
else:
msg = "Capture Frame Rate"
title = "Capture Frame Rate"
fieldNames = ["15","16","18","20","22","24","25", "Multiple frame rates"]
capture_frame_rate = [] # we start with blanks for the values
capture_frame_rate = choicebox(msg,title, fieldNames)
fps_string = 'Captured at %s fps' % capture_frame_rate
msg ="Telecine Machine"
title = "Choose the telecine machine"
choices = ["Flashtransfer", "Flashscan", "Scanner"]
scanner = choicebox(msg, title, choices)
if scanner == "Flashtransfer":
def scanner(number):
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:role', 'Telecine', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:description', '16mm Film Digitisation', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:manufacturer', 'MWA', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:modelName', 'Flashtransfer', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:signal', 'SDI', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:settings[1]', fps_string, revtmd_xmlfile)
if scanner == "Flashscan":
def scanner(number):
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:role', 'Telecine', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:description', '8mm Film Digitisation', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:manufacturer', 'MWA', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:modelName', 'Flashscan', revtmd_xmlfile)
add_to_revtmd('//revtmd:codingProcessHistory' + str([number]) + '/revtmd:signal', 'SDI', revtmd_xmlfile)
"Audio normalised to -20db",
"Broadcast Safe Filter",
"Desaturate Filter",
"Negative to positive",
"Avid Motion Editing",
"None"
]
post_processing = multchoicebox(msg, title, choices, preselect=None)
#More interviews
msg ="User?"
title = "Pick a name yo!"
choices = ["Kieran O'Leary", "Gavin Martin",
"Dean Kavanagh", "Raelene Casey",
"Anja Mahler", "Eoin O'Donohoe", "Brian Cash","Unknown"]
user = choicebox(msg, title, choices)
msg = "Fill out these things please"
title = "blablablabl"
fieldNames = ["Source Accession Number",
"Filmographic Reference Number",
"Identifier-Object Entry/Accession Number:"]
# we start with blanks for the values
fieldValues = multenterbox(msg,title, fieldNames)
# make sure that none of the fields was left blank
while 1:
if fieldValues == None: break
errmsg = ""
for i in range(len(fieldNames)):
if fieldValues[i].strip() == "":
errmsg = errmsg + ('"%s" is a required field.' % fieldNames[i])
webbrowser.open_new_tab("http://www.thepythongamebook.com")
elif selection == "toggle fullscreen":
fullscreen = not fullscreen
elif selection == "view highscore":
text = readGameFile(gamefile)
easygui.textbox("This is the Screensaver logfile", "displaying highscore", text)
# elif selection == "watch screensaver":
# watched += 1
# get return value from called pygame program (playtime)
# playtime = screensaver.screensaver(resolution, fullscreen)
# easygui.msgbox("You watched the scrensaver %i x using this game menu \nYour screen was saved for %.2f seconds" % (watched, playtime))
# writing highscore-list
# line = "date: %s player: %s playtime: %.2f seconds resolution: %ix%i fullscreen: %s \n" % (time.asctime(), playername, playtime, resolution[0], resolution[1], fullscreen)
# writeGameFile(gamefile, line)
elif selection == "change resolution":
answer = easygui.choicebox("Please select one of those screen resolutions", "x,y", reslist)
# answer gives back a string like '(320, 200)'
resolution = parse(answer)
return