def propperWindowLayout(self, menu_bar, project_matrix): """creates tree layout either with project_matrix if available, or with a table dummy :return: finished layout ready for displaying """ if len(project_matrix) == 1 and isinstance(project_matrix[0][0], sg.Text): layout = [[sg.MenuBar(menu_bar, size=(40, 40))], *project_matrix] else: collumn = sg.Column(project_matrix, scrollable=True, size=self.window_size) layout = [[sg.MenuBar(menu_bar), collumn]] return layout
def input_window(self): sg.theme("systemdefault") layout = [ [sg.MenuBar([["設定", ["基本設定"]]], key="menu1")], [ sg.Text("開始位置", font=("メイリオ", 14)), sg.InputText(size=(5, 1), key="-start_no-", font=("メイリオ", 14)), sg.Text("必要数", font=("メイリオ", 14)), sg.InputText(size=(5, 1), key="-no_of_label-", font=("メイリオ", 14)) ], [ sg.Text("ロット番号", font=("メイリオ", 14)), sg.InputText(size=(17, 1), key="-lot_no-", font=("メイリオ", 14)) ], [ sg.Submit(button_text="ラベル作成", size=(10, 1), pad=((50, 100), (0, 0)), font=("メイリオ", 14)), sg.Submit(button_text="終了", font=("メイリオ", 14)) ], ] window = sg.Window('ラベル作成', layout) while True: event, values = window.read() if event is None: print(exit) sys.exit() if event == "ラベル作成": start_no = values["-start_no-"] start_no = int(start_no) no_of_label = values["-no_of_label-"] no_of_label = int(no_of_label) lot_no = values["-lot_no-"] path = self.label_file_path input_label.InputToLabel(start_no=start_no, no_of_label=no_of_label, path=path, sheet_name=self.sheet_name, lot_no=lot_no) if event == "終了": sys.exit() # if event == "印刷": # input_to_excel.PrintOut(self.label_file_path) if values["menu1"] == "基本設定": SelectFile() window.close()
def main_window(self): """ メインwindwow # """ sg.theme("systemdefault") frame = [ [sg.Text('読み取る言語')], [sg.Radio("日本語", key="-jpn-", group_id=1)], [sg.Radio('英語', key="-eng-", group_id=1)], ] layout = [ [sg.MenuBar([["設定", ["フォルダ設定"]]], key="menu1")], [sg.Text('読み取るファイルを選択してください')], [ sg.InputText(size=(100, 1), key="-file_path-"), sg.FileBrowse('読み取るファイルを選択') ], [sg.Frame("言語選択", frame)], [sg.Submit(button_text="読み取り開始")], # [sg.Text('読み取り結果')], # [sg.Output(size=(100, 30))], [sg.Submit(button_text="閉じる")] ] window = sg.Window("OCR", layout) while True: event, values = window.read() if event is None: print("exit") sys.exit() if event == "読み取り開始": image_path = values["-file_path-"] if values["-jpn-"]: lang = "jpn" elif values["-eng-"]: lang = "eng" print(image_path) print(lang) window.close() tk_canvas.main_loop(select_lang=lang, image_path=image_path, dir_path=self.dir_path) if values["menu1"] == "フォルダ設定": SelectFile() if event == "閉じる": sys.exit() window.close()
def create_gui(self): self.logger.debug("Creating GUI") latitude_col1 = [ [PyGUI.Text("Degrees")], [PyGUI.InputText(size=(10, 1), key="latDeg", enable_events=True)], ] latitude_col2 = [ [PyGUI.Text("Minutes")], [PyGUI.InputText(size=(10, 1), key="latMin", enable_events=True)], ] latitude_col3 = [ [PyGUI.Text("Seconds")], [ PyGUI.InputText(size=(10, 1), key="latSec", pad=(5, (3, 10)), enable_events=True) ], ] longitude_col1 = [ [PyGUI.Text("Degrees")], [PyGUI.InputText(size=(10, 1), key="lonDeg", enable_events=True)], ] longitude_col2 = [ [PyGUI.Text("Minutes")], [PyGUI.InputText(size=(10, 1), key="lonMin", enable_events=True)], ] longitude_col3 = [ [PyGUI.Text("Seconds")], [ PyGUI.InputText(size=(10, 1), key="lonSec", pad=(5, (3, 10)), enable_events=True) ], ] frameelevationlayout = [ [PyGUI.Text("Feet")], [ PyGUI.InputText(size=(20, 1), key="elevFeet", enable_events=True) ], [PyGUI.Text("Meters")], [ PyGUI.InputText(size=(20, 1), key="elevMeters", enable_events=True, pad=(5, (3, 10))) ], ] mgrslayout = [ [ PyGUI.InputText(size=(20, 1), key="mgrs", enable_events=True, pad=(5, (3, 12))) ], ] framedatalayoutcol2 = [ [PyGUI.Text("Name")], [PyGUI.InputText(size=(20, 1), key="msnName", pad=(5, (3, 10)))], ] framewptypelayout = [[ PyGUI.Radio("WP", group_id="wp_type", default=True, enable_events=True, key="WP"), PyGUI.Radio("MSN", group_id="wp_type", enable_events=True, key="MSN"), PyGUI.Radio("FP", group_id="wp_type", key="FP", enable_events=True), PyGUI.Radio("ST", group_id="wp_type", key="ST", enable_events=True) ], [ PyGUI.Radio("IP", group_id="wp_type", key="IP", enable_events=True), PyGUI.Radio("DP", group_id="wp_type", key="DP", enable_events=True), PyGUI.Radio("HA", group_id="wp_type", key="HA", enable_events=True), PyGUI.Radio("HB", group_id="wp_type", key="HB", enable_events=True) ], [ PyGUI.Button( "Quick Capture", disabled=self.capture_button_disabled, key="quick_capture", pad=(5, (3, 8))), PyGUI.Text("Sequence:", pad=((0, 1), 3), key="sequence_text", auto_size_text=False, size=(8, 1)), PyGUI.Combo(values=("None", 1, 2, 3), default_value="None", auto_size_text=False, size=(5, 1), readonly=True, key="sequence", enable_events=True) ]] frameactypelayout = [[ PyGUI.Radio("F/A-18C", group_id="ac_type", default=True, key="hornet", enable_events=True), PyGUI.Radio("AV-8B", group_id="ac_type", disabled=False, key="harrier", enable_events=True), PyGUI.Radio("M-2000C", group_id="ac_type", disabled=False, key="mirage", enable_events=True), PyGUI.Radio("F-14A/B", group_id="ac_type", disabled=False, key="tomcat", enable_events=True), PyGUI.Radio("A-10C", group_id="ac_type", disabled=False, key="warthog", enable_events=True), ]] framelongitude = PyGUI.Frame("Longitude", [[ PyGUI.Column(longitude_col1), PyGUI.Column(longitude_col2), PyGUI.Column(longitude_col3) ]]) framelatitude = PyGUI.Frame("Latitude", [[ PyGUI.Column(latitude_col1), PyGUI.Column(latitude_col2), PyGUI.Column(latitude_col3) ]]) frameelevation = PyGUI.Frame("Elevation", frameelevationlayout, pad=(5, (3, 10))) frameactype = PyGUI.Frame("Aircraft Type", frameactypelayout) framepositionlayout = [ [framelatitude], [framelongitude], [ frameelevation, PyGUI.Column([ [PyGUI.Frame("MGRS", mgrslayout)], [ PyGUI.Button("Capture from DCS F10 map", disabled=self.capture_button_disabled, key="capture", pad=(1, (18, 3))) ], [ PyGUI.Text(self.capture_status, key="capture_status", auto_size_text=False, size=(20, 1)) ], ]) ], ] frameposition = PyGUI.Frame("Position", framepositionlayout) framedata = PyGUI.Frame("Data", framedatalayoutcol2) framewptype = PyGUI.Frame("Waypoint Type", framewptypelayout) col0 = [ [PyGUI.Text("Select profile:")], [ PyGUI.Combo(values=[""] + self.get_profile_names(), readonly=True, enable_events=True, key='profileSelector', size=(27, 1)) ], [ PyGUI.Listbox(values=list(), size=(30, 27), enable_events=True, key='activesList') ], [ PyGUI.Button("Add", size=(12, 1)), PyGUI.Button("Update", size=(12, 1)) ], [PyGUI.Button("Remove", size=(26, 1))], # [PyGUI.Button("Move up", size=(12, 1)), # PyGUI.Button("Move down", size=(12, 1))], [ PyGUI.Button("Save profile", size=(12, 1)), PyGUI.Button("Delete profile", size=(12, 1)) ], [PyGUI.Text(f"Version: {self.software_version}")] ] col1 = [ [PyGUI.Text("Select preset location")], [ PyGUI.Combo(values=[""] + [ base.name for _, base in self.editor.default_bases.items() ], readonly=False, enable_events=True, key='baseSelector'), PyGUI.Button(button_text="F", key="filter") ], [framedata, framewptype], [frameposition], [frameactype], [PyGUI.Button("Enter into aircraft", key="enter")], ] colmain1 = [ [ PyGUI.MenuBar([[ "Profile", [ [[ "Import", [ "Paste as string from clipboard", "Load from encoded file" ] ]], "Export", [ "Copy as string to clipboard", "Copy plain text to clipboard", "Save as encoded file" ], ] ]]) ], [PyGUI.Column(col1)], ] layout = [ [PyGUI.Column(col0), PyGUI.Column(colmain1)], ] return PyGUI.Window('DCS Waypoint Editor', layout)
import PySimpleGUI as sg import eventos import funcoes_auxiliares import mensagens informacoes_do_arquivo = dict() informacoes_do_arquivo = eventos.novo_arquivo() sg.ChangeLookAndFeel('BrownBlue') layout_menu = [[ 'Arquivo', ['Novo', 'Abrir', 'Salvar', 'Salvar Como', '------', 'Sair'] ]] layout_window = [[sg.MenuBar(layout_menu)], [ sg.Text('Novo Arquivo', size=(90, 1), key='caminho_arquivo') ], [sg.Multiline(size=(90, 25), key='texto_arquivo')]] janela = sg.Window('Notepad--', layout=layout_window, margins=(0, 0), resizable=True, return_keyboard_events=True, finalize=True) janela.maximize() janela['texto_arquivo'].expand(expand_x=True, expand_y=True)
def __init__(self) -> None: self.layout = [ sg.MenuBar([['Prefs', [self.clear_settings, self.reset_settings]]], background_color=sg.DEFAULT_BACKGROUND_COLOR, key='main_menu') ]
def main_window(self): sg.theme('systemdefault') frame1 = [ [sg.Text('検査日を選んでください', font=('メイリオ', 14))], [ sg.Listbox(self.year_list, size=(5, 3), key="year", font=('メイリオ', 14)), sg.Text("年", font=('メイリオ', 14)), sg.Listbox(self.month_list, size=(5, 3), key="month", font=('メイリオ', 14)), sg.Text("月", font=('メイリオ', 14)), sg.Listbox(self.day_list, size=(5, 3), key="day", font=('メイリオ', 14)), sg.Text("日", font=('メイリオ', 14)), sg.Submit(button_text='日付入力', font=('メイリオ', 14)) ], [sg.InputText('入力された日付を表示', key='-DATE-', font=('メイリオ', 14))], ] frame2 = [[sg.Submit(button_text='名前を付けて保存', font=('メイリオ', 14))]] frame3 = [[sg.Submit(button_text='上書き保存', font=('メイリオ', 14))]] frame4 = [[sg.Submit(button_text="在庫表へ", font=('メイリオ', 14))]] layout = [ [sg.MenuBar([["設定", ["ファイル設定"]]], key="menu1", font=('メイリオ', 14))], [sg.Text(text=self.str_day, font=('メイリオ', 14))], [sg.Frame("検査日", frame1, font=('メイリオ', 14))], [sg.Text('QRコード読み込み欄', font=('メイリオ', 14))], [ sg.Multiline(size=(100, 5), key='QR'), sg.Submit(button_text="入力", font=('メイリオ', 14)) ], # [sg.Output(size=(100,5), key='-LIST-') ], [ sg.Submit("チェック", font=('メイリオ', 14)), sg.Submit('一覧をクリア', font=('メイリオ', 14)) ], [ sg.Frame('上書き保存', frame3, font=('メイリオ', 14)), sg.Frame("名前を付けて保存", frame2, font=('メイリオ', 14)), sg.Frame('在庫表へ切り替え', frame4, font=('メイリオ', 14)) ] ] window = sg.Window('QRコード読み込み', layout) while True: event, values = window.read() if event is None: break if event == "入力": self.code_no = values["QR"] print(values["QR"]) lot_numbesr = values["QR"] self.lot_no_list = lot_numbesr.splitlines() if self.lot_no_list[-1] == '': self.lot_no_list.pop(-1) else: pass self.cd.input_data(self.lot_no_list) # self.lot_no_list.append(self.code_no) # output window用 # for lot in self.lot_no_list: # print(lot) # self.lot_no_list = [] if event == "チェック": self.cd.check_lot() self.cd.count_qty() if event == "一覧をクリア": self.lot_no_list.clear() # window['-LIST-'].update('') window['QR'].update('') if event == '日付入力': self.year = values["year"] self.month = values["month"] self.day = values["day"] self.today = "{}年{}月{}日".format(self.year[0], self.month[0], self.day[0]) window['-DATE-'].update(self.today) self.cd.input_inspect_day(self.today) if event == "名前を付けて保存": self.cd.save_as_file() if event == "上書き保存": self.cd.save_file() if event == "在庫表へ": try: a = Stock_Gui(today=self.today) a.stock_gui() except AttributeError: sg.popup_error('日付を入力してください') if values["menu1"] == "ファイル設定": Select_File() window.close()
def input_window(self): sg.theme("systemdefault") frame1 = [ [ sg.Text(text=('納入先を選んでください'), font=('メイリオ', 14)), ], [ sg.Listbox(self.to_ship_list, size=(15, 3), key="-to_ship-", font=('メイリオ', 14)), sg.Listbox(self.part_no_list, size=(15, 3), key="-part_no-", font=('メイリオ', 14)) ], [ sg.Submit(button_text="納入先選択", size=(10, 1), font=('メイリオ', 14), pad=((30, 85), (0, 0))), sg.Submit(button_text="品番選択", size=(10, 1), font=('メイリオ', 14)) ], ] frame2 = [[ sg.Text("選択した納入先", font=('メイリオ', 14), pad=((40, 130), (0, 0))), sg.Text("選択した品番", font=('メイリオ', 14)) ], [ sg.InputText(size=(20, 1), key='-select_to_ship-', font=('メイリオ', 14)), sg.InputText(size=(20, 1), key='-select_part_no-', font=('メイリオ', 14)) ]] frame3 = [ [ sg.Text("ラベル作成開始位置", font=('メイリオ', 14), pad=((5, 80), (0, 0))), sg.Text("必要枚数", font=('メイリオ', 14)) ], [ sg.InputText(size=(15, 1), key="-start_no-", font=('メイリオ', 14), pad=((5, 30), (0, 0))), sg.InputText(size=(15, 1), key="-no_of_labels", font=('メイリオ', 14)) ], ] layout = [ [sg.MenuBar([["設定", ["フォルダ設定"]]], key="menu1")], [sg.Frame( "品番選択", frame1, )], [sg.Frame('選択結果表示', frame2)], [sg.Frame("ラベル枚数設定", frame3)], [ sg.Submit(button_text=("ラベル作成"), font=("メイリオ", 14), pad=((5, 200), (0, 0))), sg.Submit(button_text="終了する", font=("メイリオ", 14)) ], ] window = sg.Window('ラベル作成', layout) while True: event, values = window.read() if event is None: print(exit) break if event == "納入先選択": name = values["-to_ship-"] print(name) try: col = self.item_dict[name[0]] part_no_Max_row = self.part_no_sheet.range( 10000, col).end('up').row self.part_no_list = self.part_no_sheet.range( (3, col), (part_no_Max_row, col)).value window["-part_no-"].update(self.part_no_list) except IndexError: sg.popup_error('納入先を選択してください') if event == "品番選択": to_ship = values["-to_ship-"] part_no = values["-part_no-"] window['-select_to_ship-'].update(to_ship) window['-select_part_no-'].update(part_no) print(part_no) if event == "ラベル作成": part_no = values["-part_no-"] start_no = values["-start_no-"] no_of_labels = values["-no_of_labels"] try: input_to_excel.InputExcel(wb=self.label_book, ws=self.label_sheet, start_no=start_no, no_of_labels=no_of_labels, part_no=part_no, path=self.label_file_path) except ValueError: sg.popup_error("納入先、品番が選択されているか確認してください") if event == "終了する": sys.exit() # if event == "印刷": # input_to_excel.PrintOut(self.label_file_path) if values["menu1"] == "フォルダ設定": SelectFile() window.close()
w1 = 720 h1 = 720 * h / w im.thumbnail((w1, h1)) # 缩放并取整,为确保万无一失,减去5个像素点 im.save(long_zip_png.format(i), quality=int(n)) # 保存缩放后的图片,保存质量100% i += 1 if __name__ == '__main__': # 设置自定义字体 my_font = 'Deja_Vu_Sans_Mono.ttf' my_font_style1 = (my_font, 11, "normal") my_font_style2 = (my_font, 13, "normal") # 构建菜单栏 menu_def = [['&帮助', ['使用说明', '关于']]] # 构建按键 layout = [[sg.MenuBar(menu_def, tearoff=True, font=my_font_style1)], [ sg.Text('pdf路径', font=my_font_style1), sg.InputText(size=(35, 1), key='pdf_path', font=my_font_style1), sg.FileBrowse(button_text='浏览文件', font=(my_font, 11, "bold")) ], [ sg.Text('拼接数量', font=my_font_style1), sg.InputText(size=(3, 1), key='number', font=my_font_style1), sg.CBox(default=True, text='自动压缩', key='auto_zip'), sg.Text('压缩比例', font=my_font_style1), sg.InputText(size=(2, 1), key='quality', default_text='92'), sg.Text('%') ],
callbacks = { # event: callback "About": lambda event, values: sg.popup(GreenInput.__doc__), "MENU_LOAD": lambda e, v: grin.load_table( sg.popup_get_file("Open a code definition file", file_types=( ("Windows 2000 files", ".w2k"), )), # This is higher level than sg.Window(...).read(close=True)[1][0] ), } window_width = 80 with closing( sg.Window( "%s %s" % (GreenInput.__name__, __version__), [ [ sg.MenuBar([ ["&File", ["&Load::MENU_LOAD"]], ["&Help", ["&About"]], ]) ], [sg.Text("Input your code here")], [sg.Input(key="CODE", size=(20, 1))], [sg.Text("Choose candidates by numbers:") ], # Some might use !@#$... [sg.Multiline(key="CANDIDATES", size=(40, 10))], [sg.Text("_" * window_width)], [ sg.Text( "Result (Select all, and press CTRL+C to copy, then CTRL+V to elsewhere):" ) ], [sg.Multiline(key="OUTPUT", size=(window_width, 20))], ],
peso e altura. Seu uso é disseminado principalmente entre profissionais que trabalham com o corpo, como médicos, fisioterapeutas e profissionais de Educação Física. É importante ressaltar que a Organização Mundial da Saúde (OMS) utiliza esse índice como indicador do nível de obesidade nos diferentes países. Fonte: Brasil escola. """) def oAutor(): sg.popup_no_titlebar('Projeto desenvolvido por Edson Lucas') menu_layout = ([['Sobre', ['&O IMC', '&Autor']]]) layout = [ [sg.MenuBar(menu_layout)], [sg.T(size=(8, 0)), sg.T('Calcule seu IMC', font=('Arial', 20, 'bold'))], [sg.T()], [sg.T('Seu IMC:', font=('Arial', 13)), sg.T(size=(10, 0), key='imc', relief='sunken', text_color='White'), sg.T('Situação:', font=('Arial', 13)), sg.T(size=(15, 0), key='situacao', relief='sunken' , text_color='White', justification='center')], [sg.T()], [sg.T('Peso recomendado', font=('Arial', 13)), sg.T(size=(10, 0), key='recomendado', relief='sunken', text_color='White')], [sg.T()], [sg.T('Seu peso', font=('Arial', 13)), sg.T(size=(4, 0)), sg.Input(size=(15, 0), key='peso', tooltip='Ex: 60.0', default_text='50.0')], [sg.T()], [sg.T('Sua altura ', font=('Arial', 13)), sg.T(size=(3, 0)), sg.Input(tooltip='Ex: 1.50', size=(15, 0), key='altura', default_text='1.50')], [sg.T()], [sg.T('Seu sexo', font=('Arial', 13), size=(10, 0)), sg.Radio('Masculino', 'RADIO1', key='masculino'), sg.Radio('Feminino', 'RADIO1', default=True, key='feminino')], [sg.T()], [sg.T(size=(11, 0)), sg.Button('Calcular', size=(10, 0), key='calcular'), sg.Button('Limpar', size=(10, 0), key='limpar')], [sg.T()], [sg.T('v.1.0', font=('Arial', 7), size=(65,0), justification='right')],
def init_layout(self): # Initialize module status display & menubar modules_row = [] modules_menu = [] for module in self.ui.app.subthread.values(): module_text = module.display_name module_id = module.module_id # Status display modules_row.append( sg.Text(text=module_text, key=f'status_{module_id}', font=('Consolas', 10), text_color='grey')) # Menubar modules_menu.append(module_text) submenu = [] submenu.append(f'Reload::menu_reload.{module_id}') submenu.append('---') if module.module_io_type is ModuleIOType.Output or module.module_io_type is ModuleIOType.Bidirectional: submenu.append(f'Manual send::manual_send.{module_id}') if module.module_io_type is ModuleIOType.Input or module.module_io_type is ModuleIOType.Bidirectional: submenu.append(f'Test input::manual_send.{module_id}') modules_menu.append(submenu) # Initialize menubar menudef = [ [ '&Modules', modules_menu + ['---', 'Reload all::menu_reload._all'] ], [ '&View', [ '&Themes', [f'{t}::set_theme.{t}' for t in sg.theme_list()], '---', '&Log window' ] ], ['&Help', [f'&About {self.ui.app.appname}']], ['&Close', ['&Minimize to taskbar', '&QUIT']], ] layout = [[sg.MenuBar(menudef)]] # modules_row.append(sg.Button('Options')) layout.append(modules_row) layout.append(self.init_action_buttons()) layout.append([ sg.Text('Manual send:'), sg.Button('GPO'), sg.Button('HTTP'), sg.Text('TPS', key='tps', size=(7, 1)) ]) layout.append([ sg.Button('no errors reported', border_width=0, button_color=(self.get_theme_color('TEXT'), self.get_theme_color('BACKGROUND'))) ]) # [sg.Combo(values=sg.theme_list(), size=(20, 1), default_value=self.ui.config.get('Theme', '( None )')), sg.Button('Change Theme')] self.layout(layout)
nowEvent = data_import(nowTime) if nowEvent == {}: eventDataSet = {} eventName = "インターバル期間" isFeverOrRound = "" else: eventDataSet = eventData.eventData(nowEvent) eventName = eventDataSet["eventName"] isFeverOrRound = isEventTest.isFeverOrRoundTest(nowTime, eventDataSet) nowEvent = {} #レイアウト作成 layout = \ [ #メニューバー [sg.MenuBar([["&File", ["&Settings", "---", "&Quit"]]], key = "menu")], #レイアウト [sg.Text("現在開催中のイベント: ", key = "eventLabel")], [sg.Text(eventName, key = "eventName", font = 20, text_color = localSettings["eventColor"], size = (len(eventName) * 2, 1))], [sg.Text(isFeverOrRound, key = "isFeverOrRound", font = 20, text_color = localSettings["feverColor"], size = (len(isFeverOrRound) * 2, 1))], [sg.Text("更新:" + (nowTime.isoformat(timespec = "seconds")).replace("T", " "), key = "update")] ] #ウィンドウ表示 window = sg.Window("モバマスイベントアラート", layout, resizable = True) #定数設定 timeout_time = 1000 * 10 #10秒
def create_main_window(self, attendees=None): box_short = (5, 1) layout = [ [ sg.MenuBar( [['File', ['Save', ['as Text'], '---', 'Exit']], [ 'Tool', [ 'Load Header Template', 'Edit Header Template', 'Load Body Template', 'Edit Body Template' ] ], ['Info', ['version']]], key='mb1') ], [sg.Text('基本情報の設定')], [ sg.Text('会議名称'), sg.InputText(default_text=self.__name.get_value(), key='<CONFERENCE_NAME>') ], [ sg.Text('日時'), sg.InputText(self.__year.get_value(), size=box_short, key='<YEAR>'), sg.Text('年'), sg.InputText(self.__month.get_value(), size=box_short, key='<MONTH>'), sg.Text('月'), sg.InputText(self.__day.get_value(), size=box_short, key='<DAY>'), sg.Text('日') ], [ sg.Text('開始時刻'), sg.InputText(self.__start_time.get_value(), size=box_short, key='<START_TIME>'), sg.Text('終了時刻'), sg.InputText(self.__end_time.get_value(), size=box_short, key='<END_TIME>') ], [ sg.Text('場所'), sg.InputText(self.__place.get_value(), key='<PLACE>') ], [ sg.Text('出席者(敬称略)'), sg.InputText(self.__attendances.get_value(), key='<ATTENDEES>') ], [ sg.Text('区切り文字'), sg.InputText(self.__separator, size=box_short, key='<SEPARATOR>'), sg.Submit('出席者の反映') ], ] if attendees is not None: for person in attendees: layout.append([sg.Text(person + 'の状況')]) layout.append([ sg.Multiline(border_width=2, key=person, auto_size_text=True), sg.Submit('編集', key=f'bt{person}') ]) return layout
""" psg.theme('Dark') # psg.theme('BrownBlue') largura = 90 altura = 25 bar_menu_layout = ( ["Editar", ["Converter para MAIÚSCULA", "Converter para Title"]], ["Sobre", ["Autor ", "Créditos"]], ) layout_window = [ [psg.MenuBar(bar_menu_layout)], [ psg.Multiline(font="Roboto 14", size=(largura, altura), right_click_menu=[ 'Contexto', ['Converter para MAIÚSCULA', 'Converter Title'] ], key="_body_multiline_") ], [ psg.Text('Localização do arquivo: ', size=(largura, 1), key='caminho_arquivo') ], ]
) ], ] # image visualizer imageViewerColumn = [[sg.Text("Choose an image from list on left")], [sg.Text(size=(100, 1), key="-TOUT-")], [sg.Image(k="-IMAGE", size=(200, 200))]] # MenuBar menu_def = [ ['&File', ['!&Open', '&Save::savekey', '---', '&Exit::exit']], ['&Help', '&About...'], ] layout = [[sg.MenuBar(menu_def)], [ sg.Column(itemSelectorColumn), sg.VSeparator(), sg.Column(imageViewerColumn) ]] # window window = sg.Window(title=title, layout=layout, size=(1920, 1080), resizable=True, ttk_theme="winnative", location=(0, 0)) while True:
def gui(self): # テーマ設定 sg.theme('systemdefault') frame1 = [ [sg.Radio('成績書を送る', 1, key="送る", font=('メイリオ', 14))], [sg.Radio('成績書を送らない', 1, key="送らない", font=('メイリオ', 14))], ] frame2 = [ [sg.Submit(button_text="実行", size=(12, 2), font=('メイリオ', 14))], ] frame3 = [[ sg.Submit(button_text="途中保存", size=(12, 2), font=('メイリオ', 14)) ]] layout = [ [sg.MenuBar([['設定', ["Excelファイル選択"]]])], [ sg.Text("検査日", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-inspect_day-") ], [ sg.Text("出荷日", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-shipping_day-") ], [ sg.Text("出荷数", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-qty-") ], [ sg.Text('指示書番号', size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-order_no-") ], [ sg.Text("引き当て番号", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-order_no2-") ], [ sg.Text("客先納期", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-delivery_day-") ], [ sg.Text("設備番号、西暦", size=(12, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-machine_no-"), sg.Text("ロット番号", size=(8, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-lot1-"), sg.Text("~", size=(1, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-lot2-") ], [ sg.Text("設備番号、西暦", size=(12, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-machine_no2-"), sg.Text("ロット番号", size=(8, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-lot3-"), sg.Text("~", size=(1, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), font=('メイリオ', 14), key="-lot4-") ], [ sg.Text("青島入荷日", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-arrival_day-") ], [ sg.Text("測定日", size=(12, 1), font=('メイリオ', 14)), sg.InputText(font=('メイリオ', 14), key="-measure_day-") ], [ sg.Text('入り数➀', size=(10, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), key="box1", font=('メイリオ', 14)), sg.Text("入り数➁", size=(12, 1), font=('メイリオ', 14)), sg.InputText(size=(10, 1), key="box2", font=('メイリオ', 14)) ], [ sg.Frame("成績書送付", frame1, font=('メイリオ', 14)), sg.Frame("入力", frame2, font=('メイリオ', 14)), sg.Frame("途中保存", frame3, font=('メイリオ', 14)) ], ] window = sg.Window("AF-M-184030 成績書情報入力", layout) while True: event, values = window.read() if event is None: print('exit') sys.exit() if event == "実行": value_dict = values self.qty = values["-qty-"] self.fs.new_file_save(values["-inspect_day-"]) if values["送る"]: value_dict["send"] = "送る" elif values["送らない"]: value_dict["send"] = '送らない' # innput_to_inspectsheetのインスタンス iti = input_to_inspectsheet.to_Inspectionsheet( value_dict, sheet=self.data_sheet) iti.inpput_data() cal_qty = iti.cal_qty qty = self.qty cd = check_data.CheckData(cal_qty, qty) cd.check_qty() if event == "Excelファイル選択": sf = SelectFile() sf.select_file() if event == '途中保存': self.fs.save_file() window.close()
def tela(): menu_def = [['&Arquivo', ['&Abrir imagem', '&Sair']], [ '&Imagem', [ '&Limpar', '&Selecionar região', '&Exibir características da imagem/região' ] ], [ '&Classificador', [ '&Ler imagens de treino', '&Treinar classificador', '&Classificar imagem/região' ] ]] layout = [ [sg.MenuBar(menu_def)], # [sg.Image(imagePath)], [sg.Column(layout='')], [sg.Column(layout='')], [sg.Column(layout='')], [sg.Text('Saída')], [sg.Output(size=(54, 5))], ] window = sg.Window('Imagem selecionada', layout) while True: event, values = window.read() if event in (None, 'Sair'): break elif event == 'Abrir imagem': filename = os.path.abspath( tkf.askopenfilename(initialdir=os.getcwd(), title="Selecione sua imagem")) # window.close() open_image(filename) elif event == 'Limpar': opencv.reset_image() elif event == 'Selecionar região': print('\n****** Selecionando Região ******') control.mark_image_rectangle = True elif event == 'Exibir características da imagem/região': print("\n****** Características da imagem ******") elif event == 'Ler imagens de treino': print("\n****** Lendo imagens de treino ******") elif event == 'Treinar classificador': print("\n****** Treinando classificador ******") elif event == 'Classificar imagem/região': print("\n****** Classificando imagem ******")