def Menubar(menu_def, text_color, background_color, pad=(0, 0)): """ A User Defined element that simulates a Menu element by using ButtonMenu elements :param menu_def: A standard PySimpleGUI menu definition :type menu_def: List[List[Tuple[str, List[str]]] :param text_color: color for the menubar's text :type text_color: :param background_color: color for the menubar's background :type background_color: :param pad: Amount of padding around each menu entry :type pad: :return: A column element that has a row of ButtonMenu buttons :rtype: sg.Column """ row = [] for menu in menu_def: text = menu[0] if sg.MENU_SHORTCUT_CHARACTER in text: text = text.replace(sg.MENU_SHORTCUT_CHARACTER, '') if text.startswith(sg.MENU_DISABLED_CHARACTER): disabled = True text = text[len(sg.MENU_DISABLED_CHARACTER):] else: disabled = False row += [sg.ButtonMenu(text, menu, border_width=0, button_color=f'{text_color} on {background_color}',key=text, pad=pad, disabled=disabled)] return sg.Column([row], background_color=background_color, pad=(0,0), expand_x=True)
def test_menus(): sg.change_look_and_feel('DarkAmber') sg.set_options(element_padding=(0, 0)) # ------ Menu Definition ------ # menu_def = [['&File', ['&Open Ctrl-O', '&Save Ctrl-S', '&Properties', 'E&xit']], ['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo'], ], ['&Toolbar', ['---', 'Command &1', 'Command &2', '---', 'Command &3', 'Command &4']], ['&Help', '&About...'], ] right_click_menu = ['Unused', ['Right', '!&Click', '&Menu', 'E&xit', 'Properties']] # ------ GUI Defintion ------ # gui = [ [sg.Menu(menu_def, tearoff=False, pad=(200, 1))], [sg.Text('Right click me for a right click menu example')], [sg.Output(size=(60, 20))], [sg.ButtonMenu('ButtonMenu', right_click_menu, key='-BMENU-'), sg.Button('Plain Button')], ] valves = [[sg.Text('VALVES')], [sg.Button('Main CH4 (1)', button_color=('White', 'Red'), key=1), sg.Button('Main GOX (2)', button_color=('White', 'Red'), key=2), sg.Button('Fire CH4 (3)', button_color=('White', 'Red'), key=3), sg.Button('Fire GOX (4)', button_color=('White', 'Red'), key=4), sg.Button('Purge (5)', button_color=('White', 'Red'), key=5), sg.Button('Igniter (0)', button_color=('White', 'Red'), key=0), ] ] layout = gui + valves window = sg.Window("Windows-like program", layout, default_element_size=(12, 1), default_button_element_size=(12, 1), right_click_menu=right_click_menu) # ------ Loop & Process button menu choices ------ # while True: event, values = window.read() if event in (None, 'Exit'): break print(event, values) # ------ Process menu choices ------ # if event == 'About...': window.disappear() sg.popup('About this program', 'Version 1.0', 'PySimpleGUI Version', sg.version, grab_anywhere=True) window.reappear() elif event == 'Open': filename = sg.popup_get_file('file to open', no_window=True) print(filename) elif event == 'Properties': second_window() window.close()
def test_menus(): sg.theme('LightGreen') sg.set_options(element_padding=(0, 0)) # ------ Menu Definition ------ # menu_def = [['&File', ['&Open Ctrl-O', '&Save Ctrl-S', '&Properties', 'E&xit']], ['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo'], ], ['&Toolbar', ['---', 'Command &1', 'Command &2', '---', 'Command &3', 'Command &4']], ['&Help', '&About...'], ] right_click_menu = ['Unused', ['Right', '!&Click', '&Menu', 'E&xit', 'Properties']] # ------ GUI Defintion ------ # layout = [ [sg.Menu(menu_def, tearoff=False, pad=(200, 1))], [sg.Text('Right click me for a right click menu example')], [sg.Output(size=(60, 20))], [sg.ButtonMenu('ButtonMenu', right_click_menu, key='-BMENU-'), sg.Button('Plain Button')], ] window = sg.Window("Windows-like program", layout, default_element_size=(12, 1), default_button_element_size=(12, 1), right_click_menu=right_click_menu) # ------ Loop & Process button menu choices ------ # while True: event, values = window.read() if event in (sg.WIN_CLOSED, 'Exit'): break print(event, values) # ------ Process menu choices ------ # if event == 'About...': window.disappear() sg.popup('About this program', 'Version 1.0', 'PySimpleGUI Version', sg.version, grab_anywhere=True) window.reappear() elif event == 'Open': filename = sg.popup_get_file('file to open', no_window=True) print(filename) elif event == 'Properties': second_window() window.close()
def make_window(theme=None): NAME_SIZE = 23 def name(name): dots = NAME_SIZE - len(name) - 2 return sg.Text(name + ' ' + '•' * dots, size=(NAME_SIZE, 1), justification='r', pad=(0, 0), font='Courier 10') sg.theme(theme) # NOTE that we're using our own LOCAL Menu element if use_custom_titlebar: Menu = sg.MenubarCustom else: Menu = sg.Menu treedata = sg.TreeData() treedata.Insert( "", '_A_', 'Tree Item 1', [1234], ) treedata.Insert("", '_B_', 'B', []) treedata.Insert( "_A_", '_A1_', 'Sub Item 1', ['can', 'be', 'anything'], ) layout_l = [ [name('Text'), sg.Text('Text')], [name('Input'), sg.Input(s=15)], [name('Multiline'), sg.Multiline(s=(15, 2))], [name('Output'), sg.Output(s=(15, 2))], [ name('Combo'), sg.Combo(sg.theme_list(), default_value=sg.theme(), s=(15, 22), enable_events=True, readonly=True, k='-COMBO-') ], [name('OptionMenu'), sg.OptionMenu([ 'OptionMenu', ], s=(15, 2))], [name('Checkbox'), sg.Checkbox('Checkbox')], [name('Radio'), sg.Radio('Radio', 1)], [name('Spin'), sg.Spin([ 'Spin', ], s=(15, 2))], [name('Button'), sg.Button('Button')], [ name('ButtonMenu'), sg.ButtonMenu('ButtonMenu', sg.MENU_RIGHT_CLICK_EDITME_EXIT) ], [name('Slider'), sg.Slider((0, 10), orientation='h', s=(10, 15))], [ name('Listbox'), sg.Listbox(['Listbox', 'Listbox 2'], no_scrollbar=True, s=(15, 2)) ], [name('Image'), sg.Image(sg.EMOJI_BASE64_HAPPY_THUMBS_UP)], [name('Graph'), sg.Graph((125, 50), (0, 0), (125, 50), k='-GRAPH-')] ] layout_r = [ [ name('Canvas'), sg.Canvas(background_color=sg.theme_button_color()[1], size=(125, 40)) ], [ name('ProgressBar'), sg.ProgressBar(100, orientation='h', s=(10, 20), k='-PBAR-') ], [ name('Table'), sg.Table([[1, 2, 3], [4, 5, 6]], ['Col 1', 'Col 2', 'Col 3'], num_rows=2) ], [name('Tree'), sg.Tree(treedata, [ 'Heading', ], num_rows=3)], [name('Horizontal Separator'), sg.HSep()], [name('Vertical Separator'), sg.VSep()], [name('Frame'), sg.Frame('Frame', [[sg.T(s=15)]])], [name('Column'), sg.Column([[sg.T(s=15)]])], [ name('Tab, TabGroup'), sg.TabGroup( [[sg.Tab('Tab1', [[sg.T(s=(15, 2))]]), sg.Tab('Tab2', [[]])]]) ], [ name('Pane'), sg.Pane([sg.Col([[sg.T('Pane 1')]]), sg.Col([[sg.T('Pane 2')]])]) ], [name('Push'), sg.Push(), sg.T('Pushed over')], [name('VPush'), sg.VPush()], [name('Sizer'), sg.Sizer(1, 1)], [name('StatusBar'), sg.StatusBar('StatusBar')], [name('Sizegrip'), sg.Sizegrip()] ] # Note - LOCAL Menu element is used (see about for how that's defined) layout = [[ Menu([['File', ['Exit']], ['Edit', [ 'Edit Me', ]]], k='-CUST MENUBAR-', p=0) ], [ sg.T('PySimpleGUI Elements - Use Combo to Change Themes', font='_ 14', justification='c', expand_x=True) ], [ sg.Checkbox('Use Custom Titlebar & Menubar', use_custom_titlebar, enable_events=True, k='-USE CUSTOM TITLEBAR-', p=0) ], [sg.Col(layout_l, p=0), sg.Col(layout_r, p=0)]] window = sg.Window('The PySimpleGUI Element List', layout, finalize=True, right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_EXIT, keep_on_top=True, use_custom_titlebar=use_custom_titlebar) window['-PBAR-'].update(30) # Show 30% complete on ProgressBar window['-GRAPH-'].draw_image( data=sg.EMOJI_BASE64_HAPPY_JOY, location=(0, 50)) # Draw something in the Graph Element return window
import PySimpleGUI as sg from ex115.lib import * layout = [[sg.Text("Cadastro de Pessoas")], [sg.Button("OK")], [sg.Button("NotOK")], [sg.ButtonMenu()]] # Create the window window = sg.Window("Demo", layout) # Create an event loop while True: event, values = window.read() # End program if user closes window or # presses the OK button if event == "OK" or event == sg.WIN_CLOSED: break window.close()
def layout(self, win_size: tuple = None): """ Create the layout for the toolbar GUI element. """ if win_size: width, height = win_size else: width, height = (mod_const.WIN_WIDTH, mod_const.WIN_HEIGHT) toolbar_h = 55 # Menu items menu_audit = self._define_menu('amenu') menu_reports = self._define_menu('rmenu') menu_user = self._define_menu('umenu') menu_menu = self._define_menu('mmenu') # Layout settings audit_ico = mod_const.AUDIT_ICON report_ico = mod_const.ARCHIVE_ICON db_ico = mod_const.DB_ICON user_ico = mod_const.USER_ICON menu_ico = mod_const.MENU_ICON padding = mod_const.TOOLBAR_PAD header_col = mod_const.HEADER_COL text_col = mod_const.TEXT_COL font = mod_const.MAIN_FONT toolbar = [ [sg.Canvas(key='-CANVAS_WIDTH-', size=(width, 0), visible=True)], [ sg.Canvas(size=(0, toolbar_h), visible=True), sg.Col([[ sg.ButtonMenu( '', menu_audit, key='-AMENU-', image_data=audit_ico, item_font=font, font=font, tooltip= 'Transaction Audits and Finance Reconciliations', button_color=(text_col, header_col), pad=(padding, padding), border_width=0), sg.ButtonMenu('', menu_reports, key='-RMENU-', image_data=report_ico, item_font=font, font=font, button_color=(text_col, header_col), border_width=0, tooltip=self.records_title, pad=(padding, padding)), sg.Button('', image_data=db_ico, key='-DBMENU-', tooltip='Record Importing', button_color=(text_col, header_col), pad=(padding, padding), border_width=0, disabled=True) ]], justification='l', background_color=header_col, expand_x=True, vertical_alignment='c'), sg.Col([[sg.Canvas(size=(0, 0), visible=True)]], justification='c', background_color=header_col, expand_x=True, vertical_alignment='c'), sg.Col([[ sg.ButtonMenu('', menu_user, key='-UMENU-', pad=(padding, padding), image_data=user_ico, button_color=(text_col, header_col), border_width=0, item_font=font, font=font, tooltip='User Settings'), sg.ButtonMenu('', menu_menu, key='-MMENU-', pad=(padding, padding), image_data=menu_ico, button_color=(text_col, header_col), border_width=0, item_font=font, font=font, tooltip='Help and program settings') ]], justification='r', background_color=header_col, vertical_alignment='c') ] ] layout = [ sg.Frame('', toolbar, key='-TOOLBAR-', pad=(0, 0), relief='groove', background_color=header_col) ] return layout
import PySimpleGUI as psg menu = ["메뉴", ["파일", ["편집", ["전체", "전체의 하부"]], "보기", ["목록", "자세히"]]] layout = [[psg.ButtonMenu("메뉴버튼", menu_def=menu)]] window = psg.Window("버튼메뉴 테스트", layout) event, values = window.read() window.close() print(event, values)
lang_def = ['&Language', ['Arabic', 'Bulgarian', 'Chinese (Simplified)', 'Chinese (Traditional)', 'Czech', 'Danish', 'Dutch', 'English', 'Finnish', 'French', 'German', 'Greek', 'Hungarian', 'Italian', 'Japanese', 'Korean', 'Norwegian', 'Polish', 'Portuguese', 'Portuguese-Brazil', 'Romanian', 'Russian', 'Spanish-Spain', 'Spanish-Latin America', 'Swedish', 'Thai', 'Turkish', 'Ukrainian', 'Vietnamese']] rev_def = ['&Revivew type', ['all', 'positive', 'negative']] purch_def = ['&Purchase type', ['all', 'non_steam_purchase', 'steam']] layout2 = \ [ [sg.Button('Exit', auto_size_button=True)], [sg.ButtonMenu('Filter:', filter_def, key='-IN1-')], [sg.ButtonMenu('Language:', lang_def, key='-IN2-')], [sg.ButtonMenu('Revivew type:', rev_def, key='-IN3-')], [sg.ButtonMenu('Purchase type:', purch_def, key='-IN4-')] ] window2 = sg.Window('Create a Word Cloud', layout2, size=(1800, 1000), auto_size_text=True, auto_size_buttons=True) filter_chosen = '' lang_chosen = '' rev_chosen = '' purch_def = '' button_clicks = {'-IN1-': None, '-IN2-': None, '-IN3-': None, '-IN4-': None} while True: # Event Loop
sg.theme('DarkGrey2') # Set Size of graph and video fig_width, fig_height = 1500, 300 video_width, video_height = 1500, 400 # Video Column Layout fig_column = sg.Column( layout=[ [sg.Image('', size=(video_width, video_height), key='-VidOut-')], [sg.Canvas(key='-FigureCanvas-', size=(fig_width, fig_height))], [ sg.Button('Save Labels', key='-SaveButton-', size=(12, 1)), sg.ButtonMenu('Speed', ['Menu', ['1x', '2x']], key='-Speed-'), sg.Button('<<5s', key='-5Sec--'), sg.Button('<1s', key='-1Sec--'), sg.B('Play', key='-StartStop-'), sg.Button('1s>', key='-1Sec+-'), sg.Button('5s>>', key='-5Sec+-'), sg.Checkbox('Auto Scroll', enable_events=True, key='-AutoScroll-'), sg.Canvas(key='-ControlsCanvas-'), ], [sg.Text('Current Sample:0 Values:', key='-CURRENT-', size=(150, 1))], ], pad=(0, 0), key='-FigColumn-' ) DATA_DIR = 'data/' VIDEOS_DIR = 'videos/' LABELS_DIR = 'labels/'
def test_menus(): # 预设 sg.change_look_and_feel('LightGreen') sg.set_options(element_padding=(0, 0)) # 定义菜单选项 menu_def = [ ['&File', ['&Open', '&Save', '&Properties', 'E&xit']], [ '&Edit', ['&Paste', [ 'Special', 'Normal', ], 'Undo'], ], # '---' 分割菜单栏 [ '&Toolbar', [ '---', 'Command &1', 'Command &2', '---', 'Command &3', 'Command &4' ] ], ['&Help', '&About...'], ] # 定义右键菜单 right_click_menu = [ 'Unused', ['Right::_Right_', '!&Click', '&Menu', 'E&xit', 'Properties'] ] # 定义布局 layout = [ [sg.Menu(menu_def, tearoff=False, pad=(20, 1))], [sg.Text('Click right on me to see right click menu')], [sg.Output(size=(60, 20))], # print() 的显示结果 [sg.ButtonMenu('ButtonMenu', key='-BMENU-', menu_def=menu_def[0])], ] # 定义 Window window = sg.Window( "Windows-like program", layout, default_element_size=(12, 1), grab_anywhere=True, # 非阻塞 right_click_menu=right_click_menu, # 添加右键菜单 default_button_element_size=(12, 1)) # 事件循环 while True: event, values = window.read() print('Event = ', event) if event in (None, 'Exit'): break # ------ Process menu choices ------ # elif event == 'About...': window.disappear() # 隐藏窗口 sg.popup('About this program', 'Version 1.0', 'PySimpleGUI rocks...', grab_anywhere=True) window.reappear() # 重现窗口 elif event == 'Open': filename = sg.popup_get_file('file to open', no_window=True) print(filename) elif event == '-BMENU-': print('You selected from the button menu:', values['-BMENU-']) elif event == 'Properties': second_window() window.close()
def bulk(): x = copy.copy(oS) y = copy.copy(oV0) xx = copy.copy(x) yy = copy.copy(y) slope, intercept, rv, pv, std_err = stats.linregress(x, y) def myfunc(x): return slope * x + intercept errorg2 = erro(x, 0) errorg = (math.sqrt(errorg2)) errors2 = erro(x, 1) errors = (math.sqrt(errors2)) x.append(0) x.append(1.1 * (float(max(x)))) mymodel = list(map(myfunc, x)) title = 'Lineweaver-Burk double reciprocal plot' sm = 'start' while sm == 'start': layout3 = [[sg.T('DATA SET', size=(103, 1), justification='center')]] headings1 = [' ', 'V0', '1/V0', '[S]', '1/[S]'] leg1 = [ sg.T(a, size=(20, 1), background_color='white', justification='center', pad=(1, 1)) for a in headings1 ] layout3.append(leg1) for a in range(len(oV0)): data1 = [ a + 1, "{:.2e}".format(float(tmpV0[a])), "{:.2e}".format(float(oV0[a])), "{:.2e}".format(float(tmpS[a])), "{:.2e}".format(float(oS[a])) ] row = [ sg.T(a, size=(20, 1), background_color='white', justification='center', pad=(1, 1)) for a in data1 ] layout3.append(row) line = [sg.T('', size=(20, 1), justification='center', pad=(1, 1))] layout3.append(line) title2 = [ sg.T('KM AND VMAX', size=(103, 1), justification='center', pad=(1, 1)) ] layout3.append(title2) headings2 = [ 'Michaelis constant (Km)', 'Maximum Reaction Rate (Vmax)', 'Slope (Km/Vmax)' ] leg2 = [ sg.T(a, size=(34, 1), background_color='white', justification='center', pad=(1, 1)) for a in headings2 ] layout3.append(leg2) data2 = [ "{:.5e}".format(slope / intercept), "{:.5e}".format(1 / intercept), "{:.5e}".format(slope) ] row2 = [ sg.T(a, size=(34, 1), background_color='white', justification='center', pad=(1, 1)) for a in data2 ] layout3.append(row2) line = [sg.T('', size=(15, 1), justification='center', pad=(1, 1))] layout3.append(line) title3 = [ sg.T('LINEAR REGRESSION', size=(103, 1), justification='center', pad=(1, 1)) ] layout3.append(title3) headings3 = [ 'Correlation Coefficient (R)', 'Coefficient of Determination (R^2)', 'Standard error', 'P-Value' ] leg3 = [ sg.T(a, size=(25, 1), background_color='white', justification='center', pad=(1, 1)) for a in headings3 ] layout3.append(leg3) data3 = [ "{:.5e}".format(rv), "{:.5e}".format(rv**2), "{:.5e}".format(std_err), "{:.5e}".format(pv) ] row3 = [ sg.T(a, size=(25, 1), background_color='white', justification='center', pad=(1, 1)) for a in data3 ] layout3.append(row3) line = [sg.T('', size=(15, 1), justification='center', pad=(1, 1))] layout3.append(line) title4 = [ sg.T('VARIANCES AND DEVIATIONS', size=(103, 1), justification='center', pad=(1, 1)) ] layout3.append(title4) headings4 = [ 'Population Variance (σ^2)', 'Population Standard Deviation (σ)', 'Sample Variance (S^2)', 'Sample Standard Deviation (S)' ] leg4 = [ sg.T(a, size=(25, 1), background_color='white', justification='center', pad=(1, 1)) for a in headings4 ] layout3.append(leg4) data4 = [ "{:.5e}".format(errorg2), "{:.5e}".format(errorg), "{:.5e}".format(errors2), "{:.5e}".format(errors) ] row4 = [ sg.T(a, size=(25, 1), background_color='white', justification='center', pad=(1, 1)) for a in data4 ] layout3.append(row4) line = [sg.T('', size=(15, 1), justification='center', pad=(1, 1))] layout3.append(line) GBM = [ 'PLOT', [ '&Show plot::-SHP-', '&Rename graph::-RNG-', '&Save as pdf::-GPDF-', '&Save as png::-GPNG-', '&Save as jpg::-GJPG-' ] ] DSM = ['DSM', ['&Save as pdf::SPNG', '&Export to excel::-EXTE-']] OPT = ['OPT', ['&Return to main menu::-RTMM-', '&End program::-ENP-']] scroll = [[ sg.Text('Project: ' + prjname), sg.Text('Date of creation: ' + doc) ], [ sg.Col(layout3, size=(846, 500), scrollable=True, vertical_scroll_only=True) ], [ sg.ButtonMenu('PLOT', GBM, key='-GBM-', size=(38, 1)), sg.ButtonMenu('DATA SET', DSM, key='-DSM-', size=(38, 1)), sg.ButtonMenu('KM AND VMAX', DSM, key='-KAV-', size=(38, 1)) ], [ sg.ButtonMenu('LINEAR REGRESSION', DSM, key='-LNR-', size=(38, 1)), sg.ButtonMenu('VARIANCES AND DEVIATIONS', DSM, key='-VAD-', size=(38, 1)), sg.ButtonMenu('OPTIONS', OPT, key='-OPT-', size=(38, 1)) ]] dg = sg.FlexForm('LBplot', scroll) eventg, valueg = dg.read() if valueg == { '-GBM-': 'Show plot::-SHP-', '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: print('a') dg.close() plt.subplot() pltnow(title, xx, yy, mymodel, x, uV, v) plt.gca().yaxis.set_minor_formatter(NullFormatter()) plt.subplots_adjust(top=0.90, bottom=0.10, left=0.14, right=0.95, hspace=0.25, wspace=0.35) fig = plt.gcf() figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg layout = [[sg.Canvas(size=(figure_w, figure_h), key='canvas')], [sg.Button('Continue', size=(21, 1), key='-grphr-')]] window = sg.Window('LBplot', layout, finalize=True, element_justification='center') fig_canvas_agg = draw_figure(window['canvas'].TKCanvas, fig) event, values = window.read() if event in (None, 'Exit'): breaqui() window.close() break elif event == '-grphr-': window.close() plt.clf() plt.close() elif valueg == { '-GBM-': 'Rename graph::-RNG-', '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: dg.close() RNG1 = [ [sg.Text("What should be the graph's title?")], [sg.InputText('', size=(51, 1), key='-title-')], [ sg.Text(" "), sg.Button('Continue', size=(20, 1), key='-rnm1-') ] ] dh = sg.Window('LBplot', RNG1, element_justification='left') kt = 'a' while kt == 'a': eventh, valueh = dh.read() if eventh == '-rnm1-': title = str(valueh['-title-']) dh.close() RNG2 = [[sg.Text(title + " is now the graph's title!")], [ sg.Button('Continue', size=(21, 1), key='-rnm2-') ]] dj = sg.Window('LBplot', RNG2, element_justification='center') kd = 'a' while kd == 'a': eventj, valuej = dj.read() if eventj == '-rnm2-': dj.close() kt = 'b' kd = 'b' break elif valueg == { '-GBM-': 'Save as pdf::-GPDF-', '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: pltnow(title, xx, yy, mymodel, x, uV, u, v) dg.close() savefig('.pdf') plt.clf() plt.close() elif valueg == { '-GBM-': 'Save as png::-GPNG-', '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: pltnow(title, xx, yy, mymodel, x, uV, u, v) dg.close() savefig('.png') plt.clf() plt.close() elif valueg == { '-GBM-': 'Save as jpg::-GJPG-', '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: pltnow(title, xx, yy, mymodel, x, uV, u, v) dg.close() savefig('.jpg') plt.clf() plt.close() elif eventg == '-DSM-': plt.clf() cap = [] V0j = format(tmpV0, "{:.2e}") oV0j = format(oV0, "{:.2e}") Sj = format(tmpS, "{:.2e}") oSj = format(oS, "{:.2e}") for bap in range(0, len(tmpV0)): cap.append(str(bap + 1)) data = {'': cap, 'V0': V0j, '1/V0': oV0j, '[S]': Sj, '1/[S]': oSj} df = pd.DataFrame(data, columns=['', 'V0', '1/V0', '[S]', '1/[S]']) if valueg == { '-GBM-': None, '-DSM-': 'Save as pdf::SPNG', '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: dg.close() pdftable(df) elif valueg == { '-GBM-': None, '-DSM-': 'Export to excel::-EXTE-', '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': None }: dg.close() exceltable(df) elif eventg == '-KAV-': plt.clf() data = { 'Michaelis constant (Km)': [("{:.5e}".format(slope / intercept))], 'Maximum Reaction Rate (Vmax)': [("{:.5e}".format(1 / intercept))], 'Slope (Km/Vmax)': [("{:.5e}".format(slope))] } df = pd.DataFrame(data, columns=[ 'Michaelis constant (Km)', 'Maximum Reaction Rate (Vmax)', 'Slope (Km/Vmax)' ]) if valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': 'Save as pdf::SPNG', '-LNR-': None, '-VAD-': None, '-OPT-': None }: dg.close() pdftable(df) elif valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': 'Export to excel::-EXTE-', '-LNR-': None, '-VAD-': None, '-OPT-': None }: dg.close() exceltable(df) elif eventg == '-LNR-': plt.clf() data = { 'Correlation Coefficient (R)': [("{:.5e}".format(rv))], 'Coefficient of Determination (R^2)': [("{:.5e}".format(rv**2))], 'Standard error': [("{:.5e}".format(std_err))], 'P-Value': [("{:.5e}".format(pv))] } df = pd.DataFrame(data, columns=[ 'Correlation Coefficient (R)', 'Coefficient of Determination (R^2)', 'Standard error', 'P-Value' ]) if valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': 'Save as pdf::SPNG', '-VAD-': None, '-OPT-': None }: dg.close() pdftable(df) elif valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': 'Export to excel::-EXTE-', '-VAD-': None, '-OPT-': None }: dg.close() exceltable(df) elif eventg == '-VAD-': plt.clf() data = { 'Population Variance (σ^2)': [str("{:.5e}".format(errorg2))], 'Population Standard Deviation (σ)': [("{:.5e}".format(errorg))], 'Sample Variance (S^2)': [("{:.5e}".format(errors2))], 'Sample Standard Deviation (S)': [("{:.5e}".format(errors))] } df = pd.DataFrame(data, columns=[ 'Population Variance (σ^2)', 'Population Standard Deviation (σ)', 'Sample Variance (S^2)', 'Sample Standard Deviation (S)' ]) if valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': 'Save as pdf::SPNG', '-OPT-': None }: dg.close() pdftable(df) elif valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': 'Export to excel::-EXTE-', '-OPT-': None }: dg.close() exceltable(df) elif valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': 'End program::-ENP-' }: dg.close() breaqui() break elif valueg == { '-GBM-': None, '-DSM-': None, '-KAV-': None, '-LNR-': None, '-VAD-': None, '-OPT-': 'Return to main menu::-RTMM-' }: dg.close() sm = 'end' continue elif eventg in (None, 'Exit'): breaqui() break