本文整理汇总了Python中Output类的典型用法代码示例。如果您正苦于以下问题:Python Output类的具体用法?Python Output怎么用?Python Output使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Output类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getChoiceFromList
def getChoiceFromList(player, prompt, list, noChoices=1):
Output.menuWindow.clear()
Output.printToWindow(prompt + '\n', Output.menuWindow)
invalidActions = player._determineValidOptions(list)
freeActions = player._determineFreeOptions(list)
count = 1
indexMapping = {}
for i, currOption in enumerate(list):
if currOption in invalidActions.keys():
Output.printToWindow('{0:2d} - {1} - {2}\n'.format(count, currOption, invalidActions.get(currOption)), Output.menuWindow, colorPair=1)
elif currOption in freeActions.keys():
Output.printToWindow('{0:2d} - {1} - {2}\n'.format(count, currOption, freeActions.get(currOption)), Output.menuWindow, colorPair=2)
indexMapping[count] = currOption
else:
Output.printToWindow('{0:2d} - {1}\n'.format(count, currOption), Output.menuWindow)
indexMapping[count] = currOption
count += 1
chosenOption = []
while True:
for i in range(0, noChoices):
Output.printToWindow('%d of %d : '%(i, noChoices), Output.menuWindow)
choice = int(Output.menuWindow.getstr(2))
#choice -= 48
if choice >= 1 and choice <= len(list):
if choice in indexMapping:
if noChoices > 1:
chosenOption.append(indexMapping[int(choice)])
else:
chosenOption = indexMapping[int(choice)]
if len(chosenOption) > 0:
return chosenOption
示例2: manual_input
def manual_input():
print('-------------------------------------------------------')
matrix = Input.insert_matrix()
print("Matrix: ")
Output.print_matrix(matrix)
result = Determinant.calculate_determinant(matrix)
print('Determinant: ' + str(Output.round_number(result)))
示例3: print_menu
def print_menu():
# run menu
while True:
clear()
print(''' Weather diary
1. Add/Edit Element
2. Remove Element
3. Show data
4. Show data by month
5. Exit
''')
ans = Input.get_choice() # input menu key
if ans == 1:
W_diary.add_data()
elif ans == 2:
W_diary.rm_data()
elif ans == 3:
Output.show_data()
elif ans == 4:
Output.show_data_by_month()
elif ans == 5:
os._exit(1)
else:
print('Try again')
示例4: generate_suite_desc
def generate_suite_desc(self):
suite_def = suite_desc_template % ( \
get_fixture_array_name(self.suite), \
get_fixture_array_name(self.suite), \
get_fixture_array_name(self.suite) )
Output.output(suite_def, self.file)
示例5: runSearch
def runSearch(path, string, optionsList, returnResults, colors):
# start the search thread and timer
startTime = time.time()
search = Search.Search(string, optionsList)
search.start()
# start the status thread
status = Output.Status(optionsList, string, search, False, colors)
status.start()
# join the threads and grab the results
search.join()
results = search.finish()
status.finish()
status.join()
# calculate the elapsed time
elapsedTime = (time.time() - startTime)
# print the search results
Output.results(path, string, optionsList, results, elapsedTime, colors)
if returnResults:
return EXIT_RESULTS, results
else:
return EXIT_CLEAN, results
示例6: generate_testcase_array
def generate_testcase_array(self):
begin = testcase_array_template_begin % (get_testcase_array_var(self.fixture))
Output.output(begin, self.file)
self.generate_testcase_array_content()
Output.output(array_template_end, self.file)
示例7: show_single_photo
def show_single_photo():
if PhotoThread.photo_load_threads()[0].is_alive():
Output.debug("PLT is still running. Sleeping 0.5s before trying again.")
Display.root().after(500, show_single_photo)
return
Display.show_single_photo()
Output.debug("Display.show_single_photo() returned")
Settings.WAIT_FOR_BUTTON_PRESS = True
Settings.ON_BUTTON_PRESS = lambda: Settings.main_script.start()
示例8: start_run
def start_run(script):
"""Starts a new run. Is called whenever someone pushes the button (when the script is waiting for it, of course)."""
global filename_schema
global download_id
Settings.runs += 1
download_id = ''.join(["%s" % randint(0, 9) for num in range(0, 8)])
filename_schema = time.strftime("photos/%Y%m%d-%H%M%S---" + download_id + "---{}.jpg")
Output.debug("start_run results: download_id=" + download_id + " filename_schema=" + filename_schema)
script.next_step()
示例9: run
def run(self):
Output.debug("PhotoLoadThread " + str(self.index) + " starting...")
# Load the photo
Output.debug("PhotoLoadThread " + str(self.index) + ": Opening...")
self.image = Image.open(self.filename)
Output.debug("PhotoLoadThread " + str(self.index) + ": Fitting...")
self.image = ImageOps.fit(self.image, (Display.image_size(self.fullsize), Display.image_size(self.fullsize)))
Output.debug("PhotoLoadThread " + str(self.index) + ": TKing...")
images()[self.index] = ImageTk.PhotoImage(self.image)
Output.debug("PhotoLoadThread " + str(self.index) + " finished.")
示例10: parameter_input
def parameter_input(string_matrix):
matrix = Input.get_matrix(string_matrix)
result = Determinant.calculate_determinant(matrix)
if str(result).lower().__contains__('e'):
return Output.exponential_output(result)
else:
if result != 0:
return Output.round_number(result)
else:
return 0
示例11: main
def main():
#Input
config=Input.load_config("appconfig.yaml")
employee_list=Input.generate_employee_data(config,Input.get_current_payperiod())
#Process
for employee in employee_list:
employee.process_employee_vcp()
#Output
print(Output.serialize(employee_list))
Output.save_to_db(config["db_setting"],employee_list)
示例12: generate
def generate(self):
fixture_desc_def = fixture_desc_template % ( \
get_fixture_desc_var(self.fixture), \
self.fixture.get_name(), \
os.path.basename(self.fixture.get_file_name()), \
get_testcase_array_var(self.fixture), \
get_testcase_array_var(self.fixture), \
get_testcase_array_var(self.fixture) )
Output.output(fixture_desc_def, self.file)
if self.recordFixture :
global fixtureDescs
fixtureDescs.append(get_fixture_desc_var(self.fixture))
示例13: test_range10MatrixWithNegatives
def test_range10MatrixWithNegatives(self):
string_matrix = '28,45,-73,-75,46,36,21,26,48,30;-86,38,-32,82,-22,-19,-29,100,-72,-3;13,84,-76,-99,-78,94,14' \
',-12,-4,56;43,-91,1,97,-11,59,61,-16,-31,-43;-60,-63,41,-52,-95,86,67,88,79,8;-28,-62,-20,' \
'-34,-51,12,-5,35,-8,-55;15,-93,34,-14,-54,-17,98,-85,-24,72;-81,18,-30,-47,50,11,39,66,90,7;' \
'-98,-87,-84,20,-97,89,19,-13,60,-23;96,44,-71,-36,-46,25,32,85,54,77'
result = 619266553777932419372
self.assertEqual(program.parameter_input(string_matrix), Output.exponential_output(result))
示例14: find
def find():
"""Returns the USB port address of the camera."""
global __path
Output.debug("In USBDevice.find()")
if Settings.SIMULATE_USB_DEVICE:
__path = "/dev/bus/usb/042/023"
Output.debug("Simulation! Pretending the device is " + __path + ".")
return __path
result = subprocess.Popen("gphoto2 --auto-detect", stdout=subprocess.PIPE, shell=True).stdout.read()
Output.debug("Result of `gphoto2 --auto-detect`: " + result)
match = re.compile("(?P<camera>[^\n]+?) +usb:(?P<device>[0-9]{3}),(?P<port>[0-9]{3})",re.MULTILINE).search(result)
if match != None:
Output.notice("Found camera: " + match.group('camera') + " on USB port " + match.group('device') + "," + match.group('port'))
__path = "/dev/bus/usb/" + match.group('device') + "/" + match.group('port')
Output.notice("Path is now: " + __path)
return __path
raise "Camera not found. Connect it to the Pi, switch it on and verify that `gphoto2 --auto-detect` finds it."
示例15: test_range12MatrixWithNegatives
def test_range12MatrixWithNegatives(self):
string_matrix = '-2,9,-46,17,50,-73,8,76,29,-77,-69,15;69,-16,65,62,24,-6,71,-80,40,-84,-19,95;27,-33,' \
'-75,-23,-67,-25,-27,36,89,70,-47,-29;85,-90,-97,84,-82,-39,-65,-26,-96,7,100,14;-49,' \
'-9,81,13,38,82,0,-66,-14,44,48,94;-42,78,-35,-86,54,-4,-59,66,4,-72,21,-52;55,39,-58,' \
'-57,-53,-85,-20,-18,49,-79,72,92;83,97,74,52,43,-36,-76,-24,-54,22,56,23;-37,93,-32,18,' \
'-10,-78,3,28,-15,96,-41,-31;-81,47,75,33,12,-94,98,-64,-38,19,-70,-21;80,-48,-7,11,25,' \
'42,31,-56,32,-51,91,-87;-91,63,10,-99,-93,58,26,-45,20,-92,-55,88'
result = 3708810380587217049754426
self.assertEqual(program.parameter_input(string_matrix), Output.exponential_output(result))