def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline:")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) Pipelines=["InitialChIPseqQC", "ChIPseq" ] Pipeline = self.Pipeline = StringVar() Pipeline.set(Pipelines[0]) om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=20,pady=5) readtypes = ['Single', 'Paired'] self.readtype = readtype = StringVar() readtype.set(readtypes[0]) readtype_menu = OptionMenu(eframe, readtype, *readtypes) readtype_menu.grid(row=3, column=3, sticky=E, pady=5) readtype_label = Label(eframe, text="-end ") readtype_label.grid( row=3, column=4, stick=W, pady=5) self.add_info(eframe) self.option_controller() self.peakinfo_fn = 'peakcall.tab' self.contrast_fn = 'contrast.tab'
class SortableCharacterMenu: src_char_list = [ "Alex", "Ryu", "Yun", "Dudley", "Necro", "Hugo", "Ibuki", "Elena", "Oro", "Yang", "Ken", "Sean", "Urien", "Gouki", "Shin Gouki", "Chun Li", "Makoto", "Q", "Twelve", "Remy" ] abc_char_list = sorted(src_char_list, key=str.lower) def __init__(self, tk_root, char_list_str): self.tk_root = tk_root self.char_list_str = char_list_str self.tk_menu = None self.sort_src() def _create_and_repack_menu(self, char_list): if self.tk_menu: self.tk_menu.pack_forget() self.tk_menu = OptionMenu(self.tk_root, self.char_list_str, *char_list, command=updateFrameColor) self.tk_menu.config(width=10, bd=1) self.tk_menu.pack() def sort_abc(self): self._create_and_repack_menu(self.abc_char_list) def sort_src(self): self._create_and_repack_menu(self.src_char_list)
def Add_Data(): global window6, app_name, category, rating, reviews, size, installs, typee, price, cont_rating, genre, last_up, cur_ver, and_ver choice = StringVar() app_name = StringVar() category = StringVar() rating = StringVar() reviews = StringVar() size = StringVar() installs = StringVar() typee = StringVar() price = StringVar() cont_rating = StringVar() genre = StringVar() last_up = StringVar() cur_ver = StringVar() and_ver = StringVar() window6 = Toplevel(window2) window6.title("Add Data") adjustWindow(window6) # configuring the window Label(window6, text="Select destination to add data", font=("Open Sans", 12, 'bold'), fg='white', bg='#2E1114').grid(row=2, column=0, pady=(5, 0)) list1 = ["APP-DATA", "USER_REVIEWS"] droplist = OptionMenu(window6, choice, *list1, command=lambda x: Add_Data12(choice)) choice.set('--Select--') droplist.config(width=25) droplist.grid(row=2, column=1, pady=(5, 0))
def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.pairs = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) PipelineLabels = ['Initial QC', 'Germline', 'Somatic Tumor-Normal', 'Somatic Tumor-Only'] Pipelines=["initialqcgenomeseq", "wgslow", 'wgs-somatic', 'wgs-somatic-tumoronly'] self.label2pipeline = { k:v for k,v in zip(PipelineLabels, Pipelines)} PipelineLabel = self.PipelineLabel = StringVar() Pipeline = self.Pipeline = StringVar() PipelineLabel.set(PipelineLabels[0]) #om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om = OptionMenu(eframe, PipelineLabel, *PipelineLabels, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=10,pady=5)
def debut(): Label(t, text='Lignes\u00A0:\u00A0').grid(column=0, row=0, sticky='e') Spinbox(t, textvariable=l, from_=1, to=100, increment=1, width=10).grid(column=1, row=0, sticky='w') Label(t, text='Colonnes\u00A0:\u00A0').grid(column=0, row=1, sticky='e') Spinbox(t, textvariable=c, from_=1, to=100, increment=1, width=10).grid(column=1, row=1, sticky='w') Label(t, text='Grille\u00A0:\u00A0').grid(column=0, row=2, sticky='e') m = OptionMenu(t, f, *options) m.config(width=15) m.grid(column=1, row=2, sticky='w') Label(t, text='', width=35).grid(column=0, row=3, columnspan=2) Button(t, text='Valider', command=fichier).grid(column=0, row=4, columnspan=2) if name == 'nt': import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( 'jeudelavie') img = PhotoImage(file='jeudelavie.png') t.protocol('WM_DELETE_WINDOW', quit) t.tk.call('wm', 'iconphoto', t._w, img) t.resizable(width=False, height=False) t.title('Taille de la grille') t.mainloop()
def update(self, motorControls): # wanneer er nieuwe aansturingen worden aangesloten # of een aansturing wordt verwijderd wordt hier het frame geupdate. if motorControls == self.motorControls: return for widget in self.widgets: widget.destroy() for control in motorControls: option = StringVar() subFrame = ttk.Frame(self.subFrame, style='My.TFrame') label = Label(subFrame, fg='black', bg='white', text=control.name) label.pack(fill=X) inrol_button = Button(subFrame, text="Inrollen", command=lambda: control.rollIn(option.get())) inrol_button.pack(fill=X) uitrol_button = Button(subFrame, text="Uitrollen", command=lambda: control.rollOut(option.get())) uitrol_button.pack(fill=X) stop_button = Button(subFrame, text="Onderbreek", command=control.stopRolling) stop_button.pack(fill=X) # optionMenu optionSubFrame = ttk.Frame(subFrame, style='My.TFrame') optionLabel = Label(optionSubFrame, fg='black', bg='white', text="Tot:") optionLabel.pack(side=LEFT) options = ["over 1 uur", "over 2 uur", "over 3 uur", "over 4 uur", "einde dag"] option.set(options[0]) optionMenu = OptionMenu(optionSubFrame, option, *options) optionMenu.config(width=10) optionMenu.pack(side=RIGHT) optionSubFrame.pack(fill=X) auto_button = Button(subFrame, text="Automatisch", command=lambda: control.setTimeout('auto')) auto_button.pack(fill=X) self.widgets.append(subFrame) subFrame.pack(padx=5, side=LEFT) self.motorControls = motorControls.copy()
def __init__(self, nb, motorControls): #hier wordt het homeframe gemaakt met de verschillende functionele knoppen voor het startscherm super().__init__(nb, "Home") self.motorControls = motorControls.copy() self.widgets = [] style = ttk.Style() style.configure('My.TFrame', background='white') # gui widgets voor het aansturen van alle schermen ter gelijke tijd self.subFrame = ttk.Frame(self, style='My.TFrame') subFrame = ttk.Frame(self.subFrame, style='My.TFrame') option = StringVar() label = Label(subFrame, fg='black', bg='white', text="Alle Schermen") label.pack(fill=X) inrol_button = Button(subFrame, text="Inrollen", command=lambda: self.rollIn(option.get())) inrol_button.pack(fill=X) uitrol_button = Button(subFrame, text="Uitrollen", command=lambda: self.rollOut(option.get())) uitrol_button.pack(fill=X) stop_button = Button(subFrame, text="Onderbreek", command=self.stopRolling) stop_button.pack(fill=X) # optionMenu optionSubFrame = ttk.Frame(subFrame, style='My.TFrame') optionLabel = Label(optionSubFrame, fg='black', bg='white', text="Tot:") optionLabel.pack(side=LEFT) options = ["over 1 uur", "over 2 uur", "over 3 uur", "over 4 uur", "einde dag"] option.set(options[0]) optionMenu = OptionMenu(optionSubFrame, option, *options) optionMenu.config(width=10) optionMenu.pack(side=RIGHT) optionSubFrame.pack(fill=X) auto_button = Button(subFrame, text="Automatisch", command=self.automatic) auto_button.pack(fill=X) subFrame.pack(padx=5, side=LEFT) self.subFrame.place(relx=0.5, rely=0.5, anchor=CENTER)
def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline:")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) Pipelines=["InitialChIPseqQC", "ChIPseq" ] Pipeline = self.Pipeline = StringVar() Pipeline.set(Pipelines[0]) om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=20,pady=5) #readtypes = ['Single', 'Paired'] #self.readtype = readtype = StringVar() #readtype.set(readtypes[0]) #readtype_menu = OptionMenu(eframe, readtype, *readtypes) #readtype_menu.grid(row=3, column=3, sticky=E, pady=5) #readtype_label = Label(eframe, text="-end ") #readtype_label.grid( row=3, column=4, stick=W, pady=5) self.add_info(eframe) self.option_controller() self.peakinfo_fn = 'peakcall.tab' self.contrast_fn = 'contrast.tab'
def create_gui(): global selected_geometry_option root = Tk() root.title("URDF Form Creator") geometry_options = { 'Box', 'Cylinder', 'Isosceles Triangle', 'Right Angled Triangle' } selected_geometry_option = StringVar(root) selected_geometry_option.trace( "w", lambda *args: callback(root, selected_geometry_option.get(), *args)) selected_geometry_option.set('Box') geometry_shape_label = Label(root, text="Geometry Shape:", borderwidth=10) geometry_shape_options = OptionMenu(root, selected_geometry_option, *geometry_options) geometry_shape_options.config(width=20) create_urdf_button: Button = Button(root, text="Create urdf", command=on_click_create_urdf) exit_button: Button = Button(root, text="Exit", command=root.quit) geometry_shape_label.grid(row=0, column=0) geometry_shape_options.grid(row=0, column=1) create_urdf_button.grid(row=3, column=0) exit_button.grid(row=3, column=1) root.mainloop()
def __init__(self, pipepanel, pipeline_name, *args, **kwargs): PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.pairs = None eframe = self.eframe = LabelFrame(self, text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid(row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5) label = Label(eframe, text="Pipeline") #,fg=textLightColor,bg=baseColor) label.grid(row=3, column=0, sticky=W, padx=10, pady=5) PipelineLabels = [ 'Initial QC', 'Germline', 'Somatic Tumor-Normal', 'Somatic Tumor-Only' ] Pipelines = [ "initialqcgenomeseq", "wgslow", 'wgs-somatic', 'wgs-somatic-tumoronly' ] self.label2pipeline = {k: v for k, v in zip(PipelineLabels, Pipelines)} PipelineLabel = self.PipelineLabel = StringVar() Pipeline = self.Pipeline = StringVar() PipelineLabel.set(PipelineLabels[0]) #om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om = OptionMenu(eframe, PipelineLabel, *PipelineLabels, command=self.option_controller) om.config() #bg = widgetBgColor,fg=widgetFgColor) om["menu"].config() #bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3, column=1, sticky=W, padx=10, pady=5)
def __init__(self, pipepanel, pipeline_name, *args, **kwargs): PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self, text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid(row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5) label = Label(eframe, text="Pipeline") #,fg=textLightColor,bg=baseColor) label.grid(row=3, column=0, sticky=W, padx=10, pady=5) Pipelines = ["CAPmirseq-plus"] Pipeline = self.Pipeline = StringVar() Pipeline.set(Pipelines[0]) om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om.config() #bg = widgetBgColor,fg=widgetFgColor) om["menu"].config() #bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3, column=1, sticky=W, padx=10, pady=5) self.add_info(eframe)
class DeleteTalkPage(Page): def __init__(self, controller, *args, **kwargs): self.controller = controller self.cursor = db.cursor(dictionary=True) Page.__init__(self, *args, logo='grid', **kwargs) eventLabel = Label(self,text="Choose the event", **labelStyle) eventLabel.grid(row = 3, column = 8) self.eventsList = [ 'Computer Vision and the Internet (VisionNet-18)', 'Natural Language Processing (NLP-18)' , 'Artificial Intelligence', 'Machine Learning/Data Engineering' ] eventVar = StringVar(self) eventVar.set(self.eventsList[0]) eventOptions = OptionMenu(self, eventVar, *self.eventsList, command=self.updateChoice) eventOptions.grid(row = 3, column = 10) eventOptions.config(**optionsStyle) talkLabel = Label(self,text="Pick Talk", **labelStyle) talkLabel.grid(row = 4, column = 8) self.talksList = [''] self.talksVar = StringVar(self) self.talksVar.set(self.talksList[0]) self.talksOptions = OptionMenu(self, self.talksVar, *self.talksList) self.talksOptions.grid(row = 4, column = 10) self.talksOptions.config(**optionsStyle) SubmitButton = Button(self,text='Delete selected talk', **buttonStyle, command=self.deleteTalk) SubmitButton.grid(row = 7, column = 8) backButton = Button(self, text="Back", **buttonStyle, command = lambda :self.controller.showFrame('AdminPage')) backButton.grid(row = 7, column = 10) def updateChoice(self,event): query = 'select title from Talk T, Event E where E.EventId = T.EventId and Name = "' + event + '"' self.cursor.execute(query) self.talksList = [] for row in self.cursor.fetchall(): self.talksList.append(row['title']) self.talksVar.set(self.talksList[0]) self.talksOptions['menu'].delete(0,"end") for talky in self.talksList: self.talksOptions['menu'].add_command(label=talky, command=lambda value=talky: self.talksVar.set(value)) def deleteTalk(self): query = 'delete from Talk where title=%s;' self.cursor.execute(query,(self.talksVar.get(),)) messagebox.showinfo(title='Deleted!',message='Deleted talk titled '+self.talksVar.get()) self.controller.showFrame('AdminPage')
class ChooseCharacterFrame(ttk.LabelFrame): """ Frame comprising character-selection drop-down. """ def __init__(self, master, characters): """ Initialise character-selection frame. """ self.master = master ttk.LabelFrame.__init__(self, master, text=SELECT_CHARACTER) self.characters = characters self.variable = StringVar() self.variable.set('') self.character_menu = OptionMenu(self, self.variable, *['']) self.character_menu.bind('<Button-1>', self._update) self.character_menu.config(width=10) self.character_menu.grid() def get_selected(self): """ Return latest value. """ character = self.variable.get() if character: return True, character return False, NO_CHARACTER def _width_match_longest(self, opt_list): """ Width of menu list must match longest menu item. """ if opt_list: lengths = [len(x) for x in opt_list] self.character_menu.config(width=max(lengths) + 2) def _update(self, _event): """ When clicking the drop-down, get the name of all characters currently in memory. """ menu = self.character_menu.children['menu'] menu.delete(0, 'end') new_choices = self.characters.get_character_names() self._width_match_longest(new_choices) for value in new_choices: menu.add_command(label=value, command=lambda v=value: self.variable.set(v)) def reset_frame(self): """ Cleans the field's value by setting it to an empty string. """ self.variable.set('')
def create_OptionMenu(self, s, frame, val, loc, func): # Set figures variable and trace changes s.set(val) s.trace("w", self.change_option) om = OptionMenu(frame, s, *func) om.place(relx=loc, relwidth=0.15, relheight=1) om.config(bg="#2874A6") om["menu"]["bg"] = "#2874A6" om["activebackground"] = "#5499C7"
def drop_down(window, user, text, options, row, rowspan=1, insert=False): label = Label(window, text=text, font=user.standard_font, bg=user.window_bg_colour) label.grid(row=row, column=0, rowspan=rowspan, padx=user.padx, pady=user.pady) entry = StringVar() drop_down = OptionMenu(window, entry, *options) drop_down.config(font=user.standard_font, anchor='w') drop_down.grid(row=row, column=1, rowspan=rowspan, sticky='ew', columnspan=2, padx=user.padx, pady=user.pady) if insert != False: entry.set(insert) return entry
def student_records(): global screen3 semester = StringVar() screen3 = Toplevel(screen) screen3.title("Student Records") adjustWindow(screen3) #configuring the window Label(screen3, text="Your Record", width='40', height="2", font=("Calibri", 22, 'bold'), fg='white', bg='#d9660a').grid(row=0, sticky='w', columnspan=4) #Label(screen3, text="", bg='#174873', width='60', height='18').place(x=0, y=127) #Label(screen3, text="", bg='white').grid(row=1,column=0) Label(screen3, text="", bg='white', width='86', height='1').grid(row=1, columnspan=4) Label(screen3, text="Select Sem:", font=("Open Sans", 12, 'bold'), fg='white', bg='#174873').grid(row=2, column=0, pady=(5, 0)) list1 = ['1', '2', '3', '4', '5', '6', '7', '8'] droplist = OptionMenu(screen3, semester, *list1, command=lambda x: fetch_record(semester)) semester.set('--0--') droplist.config(width=5) Label(screen3, text="", bg='white').grid(row=1, column=0) droplist.grid(row=2, column=1, pady=(5, 0)) Label(screen3, text="Subject Name", font=("Open Sans", 12, 'bold'), fg='white', bg='#174873').grid(row=3, column=0, pady=(15, 10)) Label(screen3, text="Your Marks", font=("Open Sans", 12, 'bold'), fg='white', bg='#174873').grid(row=3, column=1, pady=(15, 10)) Label(screen3, text="Out of", font=("Open Sans", 12, 'bold'), fg='white', bg='#174873').grid(row=3, column=2, pady=(15, 10)) Label(screen3, text="Credits Points", font=("Open Sans", 12, 'bold'), fg='white', bg='#174873').grid(row=3, column=3, pady=(15, 10))
def _createModSelector(self, root, data): modLabel = Label(self.window) removeBorders(modLabel) Color.paintDark(modLabel) modLabel.grid(column=3,row=self.currentRow, sticky='nswe', columnspan=1) variable = StringVar(self.window) variable.set("Standard") # default value options = self.config.getValue(["mods"]) option = OptionMenu(self.window, variable, *options , command=self.modSelected) option.config(relief='flat') removeBorders(option) Color.paintDark(option) Color.paintDark(option["menu"]) option.grid(column=1,row=self.currentRow, sticky='nsw', columnspan=2)
def choose_save_as(self): quality_list = [] self.choose_type = str(self.choose.get()) if self.choose_type == 'audio': quality_list = self.get_audio(self.list_video) elif self.choose_type == 'video': quality_list = self.get_video(self.list_video) if quality_list: self.variable_quality = StringVar() self.variable_quality.set(quality_list[0]) opt = OptionMenu(self, self.variable_quality, *quality_list) opt.config(width=15) opt.grid(row=5, column=2, sticky=W) self.variable_quality.trace("w", self.callback)
def windowsForm(): global tk, OptionList tk.title('自動パチスロ') tk.geometry("400x200") label = Label( text= "MONSTER HUNTERがアクティブになっている時だけキー押す\nアップデートで、hotkeyを設定できるようにするらしい\n終了するなら、アプリケーションを閉じてね", font=('Helvetica', 10), fg='Red') label.pack(side="bottom") labelTest = Label(text="パターンを選んで", font=('Helvetica', 12), fg='black') labelTest.pack(side="top") variable = StringVar(tk) variable.set(OptionList[0]) opt = OptionMenu(tk, variable, *OptionList, command=getValue) opt.config(width=90, font=('Helvetica', 12)) opt.pack(side="top")
def train(app, parent): frame = Frame(parent) name_tag = Label(frame, text=name) def update_command(v): setattr(app.bot_config, upgrade_attr_name, option_value_to_num(v)) write_bot_config(app.bot_config, app.device.serial.replace(':', "_")) upgrade_label = Label(frame, text='Upgrade Lv.') upgrade_variable = StringVar() upgrade_variable.set(num_to_option_value(getattr(app.bot_config, upgrade_attr_name))) upgrade_option = OptionMenu( frame, upgrade_variable, *lv_upgrade_options, command=update_command ) def train_command(v): setattr(app.bot_config, train_attr_name, option_value_to_num(v)) write_bot_config(app.bot_config, app.device.serial.replace(':', "_")) train_label = Label(frame, text='Training Lv.') train_variable = StringVar() train_variable.set(num_to_option_value(getattr(app.bot_config, train_attr_name))) train_option = OptionMenu( frame, train_variable, *lv_training_options, command=train_command ) name_tag.config(width=8, anchor=N + W, justify=LEFT) upgrade_option.config(width=8) train_option.config(width=8) frame.columnconfigure(0, weight=5) name_tag.grid(row=0, column=0) train_label.grid(row=0, column=2) train_option.grid(row=0, column=3) upgrade_label.grid(row=0, column=4) upgrade_option.grid(row=0, column=5) return frame, None
def __init__(self, master, board, algorithms, n=10, sorted_list=SortedList([])): master.title("Algorithms LCD") padding = 10 button_width = 20 self.master = master self.board = board self.algorithms = algorithms self.n = n self.sorted_list = sorted_list random.shuffle(self.sorted_list) self.algorithm = StringVar() self.algorithm.set(list(algorithms.keys())[0]) self.data_str = StringVar() self.data_str.set("".join(sorted_list)) data_label = Label(self.master, textvariable=self.data_str, padx=padding, pady=padding) data_label.pack(padx=padding, pady=padding) algorithm_options = [] for algorithm in algorithms.keys(): algorithm_options.append(algorithm) algorithm_options_menu = OptionMenu(master, self.algorithm, *(algorithm_options)) algorithm_options_menu.config(width=button_width) algorithm_options_menu.pack(padx=padding, pady=padding) generate_button = Button(master, text="Roll", command=self.roll_data, width=button_width) generate_button.pack(padx=padding) run_button = Button(master, text="Run", command=self.run_algorithm, width=button_width) run_button.pack(padx=padding, pady=padding)
def __init__(self, controller, *args, **kwargs): self.controller = controller self.cursor = db.cursor(dictionary=True) Page.__init__(self, *args, logo='grid', **kwargs) titleLabel = Label(self, text="Talk Title", **labelStyle) titleLabel.grid(row=3, column=8) self.title = Entry(self, **entryStyle) self.title.grid(row=3, column=10) timeLabel = Label(self, text="Start Time", **labelStyle) timeLabel.grid(row=4, column=8) self.time = Entry(self, **entryStyle) self.time.grid(row=4, column=10) spkrLabel = Label(self, text="Speaker Name", **labelStyle) spkrLabel.grid(row=5, column=8) self.spkr = Entry(self, **entryStyle) self.spkr.grid(row=5, column=10) options = [ 'Computer Vision and the Internet (VisionNet-18)', 'Natural Language Processing (NLP-18)', 'Artificial Intelligence', 'Machine Learning/Data Engineering' ] optionLabel = Label(self, text="Select Event", **labelStyle) optionLabel.grid(row=6, column=8) self.var = StringVar(self) self.var.set(options[0]) option = OptionMenu(self, self.var, *options) option.grid(row=6, column=10) option.config(**optionsStyle) SubmitButton = Button(self, text='Add Talks', **buttonStyle, command=self.addTalk) SubmitButton.grid(row=7, column=8) backButton = Button( self, text="Back", **buttonStyle, command=lambda: self.controller.showFrame('AdminPage')) backButton.grid(row=7, column=10)
def user(self): utk = Tk() utk.wm_attributes("-fullscreen", True) utk.title('User') usearch = StringVar(utk) usearchcat = StringVar(utk) usearchcat.set("Books") up = Entry(utk, width=20, textvariable=usearch).grid(row=5, column=4) Label(utk, text='Search for:', font=('Caviar Dreams', 26)).grid(row=5, column=1) # The Drop Down Menu ... Super Pain OptionList = ["Books", "Authors", "Genres"] utk.wm_attributes("-fullscreen", True) usearchcat.set(OptionList[0]) opt = OptionMenu(utk, usearchcat, *OptionList) opt.config(width=10, font=('Caviar Dreams', 12)) opt.grid(row=5, column=2)
def getInfo(): global monitor_data global monitor_select info_strings = getHwInfo() monitor_list = list() for i in range(0, len(info_strings)): monitor_data.append(dict()) hwInfoParse(info_strings[i], monitor_data[i]) monitor_list.append( str(i) + " " + monitor_data[i]["Vendor"] + " " + monitor_data[i]["Model"]) monitor_select.destroy() monitor_select = OptionMenu(window, StringVar(value="Monitor: "), *monitor_list, command=monitorChange) monitor_select.config(font=font, width=width) monitor_select.grid(row=1, column=2, sticky=W)
def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.pairs = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) Pipelines=["initialqcgenomeseq","wgslow"] Pipeline = self.Pipeline = StringVar() Pipeline.set(Pipelines[0]) om = OptionMenu(eframe, Pipeline, *Pipelines, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=10,pady=5)
class DuplicatePanel(LabelFrame): def __init__(self, root, fileList, onSelect): LabelFrame.__init__(self, root, text="Duplicated Attributes") self.grid_rowconfigure(1, weight=1) self.grid_columnconfigure(2, weight=1) self.fileList = fileList self.attribList = [] self.attribLbl = Label(self, text="Attribute") self.attribType = StringVar() self.attribMenu = OptionMenu(self, self.attribType, *DUPLICATE_TYPES) self.list = ScrollList(self, onSelect) self.attribMenu.config(width=10) self.attribType.set(DUPLICATE_TYPES[0]) self.attribType.trace("w", self.refresh) self.attribLbl.grid(row=0, column=0, padx=5, pady=5, sticky="w") self.attribMenu.grid(row=0, column=2, padx=5, pady=5, sticky="w") self.list.grid(row=1, column=0, columnspan=3, padx=5, pady=5, sticky="nesw") # refresh this panel def refresh(self, *args): val = self.attribType.get() self.attribList = self.fileList.getDuplicatedAttributes(val) self.list.setData(self.attribList) # get selected attribute type def getType(self): return self.attribType.get() # get selected attribute value def getValue(self): sel = self.list.getSelection() return None if sel == -1 else self.attribList[sel]
def __init__(self, pipepanel, pipeline_name, *args, **kwargs): PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self, text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid(row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5) label = Label(eframe, text="Pipeline") #,fg=textLightColor,bg=baseColor) label.grid(row=3, column=0, sticky=W, padx=10, pady=5) PipelineLabels = ["miRSeq_v2", "CAPmirseq-plus"] Pipelines = ["miRSeq_v2", "CAPmirseq-plus"] self.label2pipeline = {k: v for k, v in zip(PipelineLabels, Pipelines)} PipelineLabel = self.PipelineLabel = StringVar() Pipeline = self.Pipeline = StringVar() PipelineLabel.set(PipelineLabels[0]) om = OptionMenu(eframe, PipelineLabel, *PipelineLabels, command=self.option_controller) om.config() #bg = widgetBgColor,fg=widgetFgColor) om["menu"].config() #bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3, column=1, sticky=W, padx=10, pady=5) # self.mirseqOpts = mirseqOpts = LabelFrame(eframe,text="miRSeq Settings") self.novelMirsFrame = novelMirsFrame = Frame(eframe) self.novelMirs = novelMirs = StringVar() novelMirLabel = Label(novelMirsFrame, text="Identify Novel miRNAs: ") novelMirsDropdown = ["YES", "NO"] novelMirs.set(novelMirsDropdown[1]) novelMirs_om = OptionMenu(novelMirsFrame, novelMirs, *novelMirsDropdown) novelMirLabel.grid(row=5, column=1, sticky=W, padx=10, pady=5) novelMirs_om.grid(row=5, column=2, sticky=W, padx=10, pady=0) # novelMirsFrame.grid(row=5,column=0, columnspan=4, sticky=W, padx=20, pady=10 ) self.add_info(eframe) self.option_controller()
def __init__(self, controller, *args, **kwargs): self.controller = controller self.cursor = db.cursor(dictionary=True) Page.__init__(self, *args, logo='grid', **kwargs) eventLabel = Label(self,text="Choose the event", **labelStyle) eventLabel.grid(row = 3, column = 8) self.eventsList = [ 'Computer Vision and the Internet (VisionNet-18)', 'Natural Language Processing (NLP-18)' , 'Artificial Intelligence', 'Machine Learning/Data Engineering' ] eventVar = StringVar(self) eventVar.set(self.eventsList[0]) eventOptions = OptionMenu(self, eventVar, *self.eventsList, command=self.updateChoice) eventOptions.grid(row = 3, column = 10) eventOptions.config(**optionsStyle) talkLabel = Label(self,text="Pick Talk", **labelStyle) talkLabel.grid(row = 4, column = 8) self.talksList = [''] self.talksVar = StringVar(self) self.talksVar.set(self.talksList[0]) self.talksOptions = OptionMenu(self, self.talksVar, *self.talksList) self.talksOptions.grid(row = 4, column = 10) self.talksOptions.config(**optionsStyle) SubmitButton = Button(self,text='Delete selected talk', **buttonStyle, command=self.deleteTalk) SubmitButton.grid(row = 7, column = 8) backButton = Button(self, text="Back", **buttonStyle, command = lambda :self.controller.showFrame('AdminPage')) backButton.grid(row = 7, column = 10)
class Frontend(): def __init__(self,x,y,b): self.x=str(x) #1600 self.y=str(y) #900 self.pressed=0 self.b=10 self.c=30 self.grapher=0 self.graph=[0,0,0,0] self.root=b def startwindow(self): # self.root=Tk() a=str(self.x+'x'+self.y) self.root.title('Wahrscheinlichkeinten & Simulation') self.root.geometry(a) self.g=Label(self.root,bg='white') self.g.place(x=0,y=0,width=self.x,height=self.y) # self.g.bind('<1>',self.optioncanged) self.lst1 = ['Marriage','Atom','BubbleGum','House_of_Cards','Lotto','SecretSanta','Coins'] self.var1 = StringVar(self.root) self.var1.set('Marriage') self.drop = OptionMenu(self.root,self.var1,*self.lst1) self.drop.config(font=('Arial',(30)),bg='white') self.drop['menu'].config(font=('calibri',(20)),bg='white') self.drop.pack(side=TOP) self.photo = PhotoImage(file='z1.gif') self.label = Label(image=self.photo,borderwidth=0) self.label.image = self.photo self.label.bind('<1>',self.MouseOneDown) self.label.place(y=0,x=int(self.x)-200) self.startbutton=Button(self.root,text='Start',font=('Arial',40),bg='#B4045F',borderwidth=5,command=self.startpressed) self.startbutton.place(x=0,y=int(self.y)-100,width=int(self.y)-200,height=100) self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) def startpressed(self): if self.grapher==1: for x in range(len(self.graph)): if self.graph[x]!=0: self.graph[x].destroy() self.grapher=0 self.root.update() a=self.var1.get() if self.pressed==1: try: self.b=int(self.changer0.get('1.0','end-1c')) except (AttributeError,TclError,ValueError): self.b=10 try: self.c=self.changer2.get('1.0','end-1c') except (AttributeError,TclError,ValueError): self.c=1 if a=='Marriage': self.run0=Marriage(self.b) self.run0.DEBUG=False self.run0.sim() elif a=='Atom': self.c=float(self.c) self.run1=Atom(self.c,self.b) self.run1.DEBUG=False self.run1.sim() elif a=='BubbleGum': self.run2=BubbleGum(self.b) self.run2.DEBUG=False self.run2.sim() self.grapher=1 self.graph=[0,0] g=str(round(self.run2.getrel()[0],4)) h=str(round(self.run2.getrel()[1],4)) self.graph[0]=Label(self.root,bg='white',text='Durchschnitt Karten zu viel: '+g,font=('calibri',19)) self.graph[0].place(x=10,y=450) self.graph[1]=Label(self.root,bg='white',text='Durchschnitt dass es passiert: '+h,font=('calibri',19)) self.graph[1].place(x=10,y=500) elif a=='House_of_Cards': if self.c=='': self.c=0 else: self.c=int(self.c) self.run3=House_of_Cards(self.b,self.c) self.run3.DEBUG=False self.run3.sim() self.grapher=1 self.graph=[0] self.graph[0]=Label(self.root,bg='white',text=('Durchschnitt: '+str(round(self.run3.getrel(),4))),font=('calibri',19)) self.graph[0].place(x=10,y=450) elif a=='Lotto': self.run4=Lotto(self.b) self.run4.DEBUG=False self.run4.sim() x=4 y=1 count=0 self.graph=[0,0,0,0] self.grapher=1 self.graph[0]=Label(self.root,bg='black') self.graph[0].place(x=10,width=10+(int(self.x)*0.8),height=1,y=int(self.y)-int(self.y)/4*0.5-350) self.graph[1]=Label(self.root,text='50%',bg='white',font=('calibri',10)) self.graph[1].place(x=60+(int(self.x)*0.8),width=50,height=50,y=int(self.y)-int(self.y)/4*0.5-375) self.graph[2]=Label(self.root,bg='black') self.graph[2].place(x=10,width=20,height=1,y=int(self.y)-350) self.graph[3]=Label(self.root,bg='black') self.graph[3].place(x=10,width=20,height=1,y=int(self.y)-int(self.y)/4-350) for draw in self.run4.turns: if draw.count(0) == 0: count += 1 elif draw.count(1) == 0: count += 1 elif draw.count(2) == 0: count += 1 elif draw.count(3) == 0: count += 1 elif draw.count(4) == 0: count += 1 elif draw.count(5) == 0: count += 1 self.graph+=[0] self.graph[x]=Label(self.root,bg='red') if str(self.c)=='1': self.graph[x].place(x=int(10+(int(self.x)*0.8)*((y-1)/self.b)),width=int(1250/self.b),height=int(self.y)-350-(int(int(self.y)-int(self.y)/4*(count/y)-350)),y=int(int(self.y)-int(self.y)/4*(count/y)-350)) else: self.graph[x].place(x=int(10+(int(self.x)*0.8)*(y/self.b)),width=3,height=3,y=int(int(self.y)-int(self.y)/4*(count/y)-350)) x+=1 y+=1 self.root.update() elif a=='SecretSanta': if self.c=='': self.c=1 else: self.c=int(self.c) self.run5=SecretSanta(self.b,self.c) self.run5.DEBUG=False self.run5.sim() self.grapher=1 self.graph=[0] self.graph[0]=Label(self.root,bg='white',text=('Durchschnitt: '+str(round(self.run5.getrel(),4))),font=('calibri',19)) self.graph[0].place(x=10,y=450) elif a=='Coins': self.run6=Coins(self.b) self.run6.sim() self.grapher=1 self.graph=[0,0] v=self.run6.geterg() vv=self.run6.getrel() self.graph[0]=Label(self.root,bg='white',text=('Statistik für www: '+str(v[0])+' '+str(vv[0])),font=('calibri',19)) self.graph[0].place(x=10,y=450) self.graph[1]=Label(self.root,bg='white',text=('Statistik für zwz: '+str(v[1])+' '+str(vv[1])),font=('calibri',19)) self.graph[1].place(x=10,y=500) def csvpressed(self): a=self.var1.get() if a=='Marriage': self.run0.exportcsv('Marriage_Simulation.csv') elif a=='Atom': self.run1.exportCSV('Atom_Simulation.csv') elif a=='Lotto': self.run4.exportCSV('Lotto_Simulation.csv') # def optioncanged(self,event): # a=self.var1.get() # if a=='Marriage': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) # elif a=='Atom': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) # elif a=='BubbleGum': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) # elif a=='House_of_Cards': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) # elif a=='Lotto': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) #elif a=='SecretSanta': # self.csvbutton.destroy() # self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) # self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) def MouseOneDown(self,event): if self.pressed==0: a=self.var1.get() if a=='Marriage': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='Atom': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Anzahl der Atome:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-600,width=450,height=50) self.changer2=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer2.place(y=200,x=int(self.x)-150,width=100,height=50) self.changer3=Label(self.root,text='Zerfallswahrscheinlichkeit:',bg='white',font=('Arial',30),borderwidth=1) self.changer3.place(y=200,x=int(self.x)-650,width=500,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='BubbleGum': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='House_of_Cards': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.changer2=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer2.place(y=200,x=int(self.x)-150,width=100,height=50) self.changer3=Label(self.root,text='Kartenanzahl(32,55):',bg='white',font=('Arial',30),borderwidth=1) self.changer3.place(y=200,x=int(self.x)-620,width=450,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='Lotto': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.changer2=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer2.place(y=200,x=int(self.x)-150,width=100,height=50) self.changer3=Label(self.root,text='Version:',bg='white',font=('Arial',30),borderwidth=1) self.changer3.place(y=200,x=int(self.x)-400,width=250,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='green',borderwidth=5,command=self.csvpressed) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='SecretSanta': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.changer2=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer2.place(y=200,x=int(self.x)-150,width=100,height=50) self.changer3=Label(self.root,text='Anzahl der Schüler:',bg='white',font=('Arial',30),borderwidth=1) self.changer3.place(y=200,x=int(self.x)-550,width=400,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) elif a=='Coins': self.changer0=Text(self.root,bg='white',font=('Arial',30),borderwidth=1) self.changer0.place(y=100,x=int(self.x)-150,width=100,height=50) self.changer1=Label(self.root,text='Versuche:',bg='white',font=('Arial',30),borderwidth=1) self.changer1.place(y=100,x=int(self.x)-400,width=250,height=50) self.csvbutton.destroy() self.csvbutton=Button(self.root,text='Export CSV',font=('Arial',40),bg='gray',borderwidth=5) self.csvbutton.place(x=int(self.x)/2+50,y=int(self.y)-100,width=int(self.y)-230,height=100) self.pressed=1 else: try: self.c=self.changer2.get('1.0','end-1c') self.changer3.destroy() self.changer2.destroy() except (AttributeError,TclError): z=0 try: self.b=self.changer0.get('1.0','end-1c') self.changer1.destroy() self.changer0.destroy() except (AttributeError,TclError): z=0 if self.b=='': self.b=1 else: self.b=int(self.b) if self.c=='': self.c=1 else: self.c=int(float(self.c)) self.pressed=0
class SnapMenu(TkOverlay): def __init__(self, root=None): super().__init__(root) self.water_company = StringVar() state = state_manager.get() if "water_company" in state: self.water_company.set(state["water_company"]) else: self.water_company.set("United Utilities") self.generate_frames() self.generate_header() self.generate_title("Select a Water Company") self.resize(450, 300) if not Path(path.join(Env.appdata_path, "images/initial.png")).exists(): self.root.destroy() print("No initial image found") Utils.send_toast("Couldn't find initial image", "You must take a screenshot first", duration=5) exit() if not Path(path.join(Env.appdata_path, "state.json")).exists(): self.root.destroy() print("No state file found") Utils.send_toast("Couldn't find state file", "You must take a screenshot first", icon_path=path.join(Env.index_dir, "icon.ico"), duration=5) exit() self.root.bind("<Key>", self.key_press) self.water_company_dropdown = OptionMenu(self.front_frame, self.water_company, *WATER_COMPANIES.keys()) self.water_company_dropdown.config(font=("Courier", 12), bg="#212121", fg="white", highlightthickness=0, relief=FLAT) self.water_company_dropdown.pack(side=TOP, pady=(0, 20)) self.button_label = Label(self.front_frame, text="Choose an Option", font=("Courier", 16), pady=10, bg="#212121", fg="white") self.button_label.pack(side=TOP) self.divider_frame = Frame(self.front_frame, bg="white", width=120, height=1) self.divider_frame.pack(side=TOP, pady=(0, 10)) self.button_frame = Label(self.front_frame, bg="#212121") self.button_frame.pack(side=TOP) self.generate_button("Clean", self.start_clean, self.button_frame) self.generate_button("Drainage", self.start_drainage, self.button_frame) self.generate_button("Cancel", self.root.destroy, self.button_frame) self.root.after(1, self.root.focus_force) self.root.mainloop() def on_back_destroy(self): state_manager.update({"water_company": self.water_company.get()}) def start_clean(self): self.back_frame.destroy() Snap(self.root, "clean", self.water_company.get()) def start_drainage(self): self.back_frame.destroy() Snap(self.root, "drainage", self.water_company.get()) def key_press(self, event): key_events = { 27: self.root.destroy, 67: self.start_clean, 68: self.start_drainage } try: key_events[event.keycode]() except: pass
def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) PipelineLabels=["CellRanger","Initial/QC","Clustering" ] Pipelines=["cellranger","scrnaseqinit","scrnaseqcluster"] self.label2pipeline = { k:v for k,v in zip(PipelineLabels, Pipelines)} PipelineLabel = self.PipelineLabel = StringVar() self.Pipeline = StringVar() PipelineLabel.set(PipelineLabels[0]) om = OptionMenu(eframe, PipelineLabel, *PipelineLabels, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=10,pady=5) self.crOpts = crOpts = LabelFrame( eframe, text="CellRanger Settings" ) self.scrCRID = scrCRID = StringVar() scrCRID.set("SPECIFY_PREFIX_HERE") self.scrExpected = scrExpected = StringVar() scrExpected.set("3000") scrcridL = Label(crOpts, text="CellRanger Sample ID: ") scrcridE = Entry(crOpts, bd =2, width=25, textvariable=scrCRID) scrcridL.grid(row=9,column=1,sticky=W,padx=10,pady=5) scrcridE.grid(row=9,column=2,sticky=W,padx=0,pady=5) screxpectedL = Label(crOpts, text="Expected number of cells: ") screxpectedE = Entry(crOpts, bd =2, width=8, textvariable=scrExpected) screxpectedL.grid(row=10,column=1,sticky=W,padx=10,pady=5) screxpectedE.grid(row=10,column=2,sticky=W,padx=0,pady=5) self.clusterOpts = clusterOpts = LabelFrame( eframe, text="Clustering and tSNE Options" ) self.scrPCs = scrPCs = StringVar() scrPCs.set("12") self.scrRes = scrRes = StringVar() scrRes.set("0.6") #scrPCs.trace('w', lambda a,b,c,x="scrPCs": makejson(x)) #Filter out genes < [5] read counts in < [2] samples scrpcsL = Label(clusterOpts, text="Include principal components 1 through ") scrpcsE = Entry(clusterOpts, bd =2, width=3, textvariable=scrPCs) scrresL = Label(clusterOpts, text="with clustering resolution: ") scrresE = Entry(clusterOpts, bd =2, width=3, textvariable=scrRes) scrpcsL.grid(row=9,column=1,sticky=W,padx=10,pady=5) scrpcsE.grid(row=9,column=2,sticky=W,padx=0,pady=5) scrresL.grid(row=9,column=3,sticky=W,padx=5,pady=5) scrresE.grid(row=9,column=4,sticky=W,padx=0,pady=5) #scrRes.trace('w', lambda a,b,c,x="scrPCs": makejson(x)) clusterOpts.grid( row=8, column=0, columnspan=4, sticky=W, padx=20, pady=10 ) self.qcOpts = qcOpts = LabelFrame( eframe, text="Initial Settings" ) countL = Label( qcOpts, text="Counts/Matrix Dir:" ) countL.grid(row=9, column=1, sticky=W, padx=10, pady=5 ) countpath=StringVar() self.countpath = countpath count_entry = Entry(qcOpts, bd =2, width = 50, #bg = entryBgColor, #fg = entryFgColor, textvariable = countpath, state='normal' ) count_entry.grid( row=9, column=2, columnspan=3 ) self.count_button = count_button = Button( qcOpts, text="Open Directory", command=self.set_count_directory ) count_button.grid( row=9, column=5 ) ##################### self.option_controller()
def init_project_frame( self ) : projframe = Frame(self) ###################### #The Project Entry Form # #Current design inherited from others #is very bad. It should have been made as #json or dictionary as is in this point #then the subsequent coding will be much #eaiser. #BK ###################### BS=StringVar() self.eprojectid = eprojectid= StringVar() self.eorganism = eorganism=StringVar() self.eanalyst = eanalyst=StringVar() self.epoc = epoc=StringVar() self.epi = epi=StringVar() self.euser = euser=StringVar() self.eflowcell = eflowcell=StringVar() self.eplatform = eplatform=StringVar() eplatform.set("Illumina") self.technique = technique=StringVar() self.pipehome = pipehome=StringVar() pipehome.set(PIPELINER_HOME) editframe = Frame( self ) editframe.grid( column=0, row=3, columnspan=3 ) projpanel1 = LabelFrame(editframe,text="Project Information") #,fg=textLightColor,bg=baseColor) projpanel1.pack( side = TOP, fill=X, padx=10, pady=5, expand=YES ) pipeline_panel = LabelFrame(editframe, text="Global Settings") pipeline_panel.pack( side=TOP, fill=X, padx=10, pady=5, expand=YES ) l=Label( pipeline_panel, text="Genome:" ) l.grid(row=1,column=3,sticky=W,padx=0,pady=5) l = Label( pipeline_panel, text="Pipeline Family:" ) l.grid(row=1,column=1,sticky=W,padx=0,pady=5) annotations=['hg19','mm10','mm9','hg38','GRCh38'] self.annotation = annotation = StringVar() annotation.set(annotations[0]) #annotation.trace('w', lambda *_ :settargets(annotation) ) om = OptionMenu(pipeline_panel, annotation, *annotations, command=self.set_pipeline) #, command=lambda _:makejson("refsets")) om.config() #bg = widgetBgColor,fg=widgetFgColor) om["menu"].config() #bg = widgetBgColor,fg=widgetFgColor) om.grid(row=1,column=4,sticky=W,padx=10,pady=10) pfamilys = ['exomeseq', 'rnaseq', 'genomeseq', 'mirseq', 'ChIPseq', 'scrnaseq'] self.pfamily = pfamily = StringVar() pfamily.set('Select a pipeline') om = OptionMenu(pipeline_panel, pfamily, *pfamilys, command=self.set_pipeline) #, command=lambda _:makejson(pfamily.get())) om.config() #bg = widgetBgColor,fg=widgetFgColor) om["menu"].config() #bg = widgetBgColor,fg=widgetFgColor) om.grid(row=1,column=2,sticky=W,padx=10,pady=5) #add_button = Button( pipeline_panel, # text="Set a pipeline", # command=self.add_pipeline # ) #add_button.grid(row=1, column=5, sticky=W, padx=10, pady=5) self.notebook = notebook = Notebook( editframe ) self.pipelineframe = None #the pipeline frame in the notebook frame! projpanel2 = Frame(notebook) #,fg=textLightColor,bg=baseColor) projpanel2.pack( side = LEFT, fill=BOTH, padx=10, pady=5, expand=YES ) notebook.add( projpanel2, text="Project Description" ) notebook.pack( side=LEFT, fill=BOTH, padx=10, pady=5, expand=YES ) Dscrollbar = Scrollbar(projpanel2) Dscrollbar.grid(row=2,column=4,rowspan=40) self.description =description= Text(projpanel2, width=75, height=28, #bg=commentBgColor, #fg=commentFgColor, font=("nimbus mono bold","10"), yscrollcommand = Dscrollbar.set) description.delete("1.0", END) description.insert(INSERT, "Enter CCBR Project Description and Notes here.") #description.bind('<FocusOut>',lambda _:makejson("none")) description.grid(row=2,column=3,sticky="e",padx=10,pady=5) Dscrollbar['command']=description.yview L=Label(projpanel1, text="Project Id", anchor="ne" ) #,bg=baseColor,fg=textLightColor) E = Entry(projpanel1, bd =2, width=20, #bg=entryBgColor, #fg=entryFgColor, textvariable=eprojectid ) #L.pack(pady=5,padx=5) #E.pack(pady=1,padx=5) L.grid(row=0, column=0, sticky=W, padx=10, pady=5) E.grid(row=0, column=2, sticky=W, padx=10, pady=5) eprojectid.set("project") #eprojectid.trace('w', makejson) L2=Label(projpanel1, text = "(Examples: CCBR-nnn,Labname or short project name)", anchor="ne" )#,bg="firebrick",fg="white") L2.grid(row=0, column=3, padx=10, pady=5, sticky="w") L=Label( projpanel1, text="Email address", anchor="ne")#,bg=baseColor,fg=textLightColor) E = Entry( projpanel1, bd =2, width=20, #bg=entryBgColor, #fg=entryFgColor, textvariable=euser) L3 = Label(projpanel1, text ="(Mandatory field: must use @nih.gov email address)", anchor="ne") L3.grid(row=1,column=3,padx=10,pady=5,sticky="w") L.grid(row=1,column=0,sticky=W,padx=10,pady=5) E.grid(row=1,column=2,sticky=W,padx=10,pady=5) #euser.trace('w', makejson) L=Label(projpanel1,text="Flow Cell ID",anchor="ne") E = Entry(projpanel1, bd =2, width=20, textvariable=eflowcell )#, bg=entryBgColor) L4=Label( projpanel1, text="(Examples: FlowCellID, Labname, date or short project name)", anchor="ne" )#,bg="firebrick",fg="white") L4.grid(row=2,column=3,padx=10,pady=5,sticky="w") L.grid(row=2,column=0,sticky=W,padx=10,pady=5) E.grid(row=2,column=2,sticky=W,padx=10,pady=5) eflowcell.set("stats") #eflowcell.trace('w', makejson) Projscrollbar = Scrollbar(projframe) Projscrollbar.grid(row=2,column=4,rowspan=30 ) self.jsonconf = jsonconf = Text( projframe, width=80, height=30, #bg=projectBgColor, #fg=projectFgColor, font=("nimbus mono bold","11"), yscrollcommand = Projscrollbar.set) Projscrollbar['command']=jsonconf.yview jsonconf.grid(row=3,column=0,sticky="e",padx=10,pady=5)
class Ucitavanje(Frame): # Konstruktor frejma def __init__(self, koren): # Log poruka o pokretanju frejma print('Odaberite slike za transformaciju.') # Pozivanje konstruktora roditeljske klase super().__init__(koren) # Lista slika za spajanje self.master.slike = [] self.fajlovi = [] # Inicijalizacija elemenata GKI self.init_gki() # Inicijalizacija elemenata GKI def init_gki(self): # Postavljanje velicine i pozicije prozora poz = self.master.poz dim = self.master.dim self.master.geometry(f'{dim[0]}x{dim[1]}+{poz[0]}+{poz[1]}') # Okvir za odabir okvir = LabelFrame(self, text='Одаберите слике:', padx=5, pady=5) okvir.grid(column=0, row=0, padx=15, pady=10) # Dugme za pretragu self.pret = Button(okvir, text='Претражи (P)', command=self.pretrazi) self.pret.grid(column=2, row=0, padx=5, pady=5) self.master.bind('<P>', self.pretrazi) self.master.bind('<p>', self.pretrazi) # Dugme za spajanje self.spojd = Button(okvir, text='Спој (S)', command=self.spoj) self.spojd.grid(column=1, row=0, padx=5, pady=5) self.master.bind('<S>', self.spoj) self.master.bind('<s>', self.spoj) # Padajuci meni za projekciju self.tr = StringVar(self) self.tr.set('ручно') self.meni = OptionMenu(okvir, self.tr, 'ручно', 'раван', 'ваљак') self.meni.grid(column=3, row=0, padx=5, pady=5) # Kutijica sa spiskom slika self.kutijica = Text(okvir, height=5, width=30, state='disabled') self.kutijica.grid(column=1, columnspan=3, row=1) # Vezivanje dogadjaja self.master.bind('<Button-3>', self.restart) self.master.bind('<R>', self.restart) self.master.bind('<r>', self.restart) # Racunanje panorame def pano(self, srednja): try: self.master.rez = panorama(self.master.slike, srednja, self.tr.get() == 'ваљак') except: pass # Prelazak na naredni frejm try: self.master.poz = self.master.winfo_x(), self.master.winfo_y() self.master.postavi_frejm(Rezultat) except: pass # Spajanje slika def spoj(self, dog=None): if not self.master.slike: showerror('Грешка', 'Нисте одабрали слике за спајање.') return # Opozivanje dogadjaja self.master.unbind('<P>') self.master.unbind('<p>') self.master.unbind('<R>') self.master.unbind('<r>') self.master.unbind('<S>') self.master.unbind('<s>') self.master.unbind('<Button-3>') # Odredjivanje srednje slike n = len(self.master.slike) - 1 if n == 0: srednja = None else: srednja = askinteger( 'Центар панораме', 'За коју слику желите да буде центар панораме,\n' f'дакле, фиксирана? Дозвољени опсег је [1, {n+1}].\n' f'Препоручена вредност је средња слика, овде {n//2+1}.\n' 'Она ће бити одабрана уколико ништа не унесете.', parent=self, minvalue=1, maxvalue=n + 1) # Automatski odabir ako korisnik odustane if srednja is None: srednja = n // 2 else: srednja -= 1 # Rucno spajanje zahteva novi frejm if self.tr.get() == 'ручно': # Priprema slika za obilazak redom; # uzimanje poslednje slike kao pocetne self.master.rez = self.master.slike.pop() # Nema posla ako je samo jedna slika if n == 0: self.master.postavi_frejm(Rezultat) return # Sleva se spaja leva polovina panorame for i in range(srednja): self.master.slike[i] = self.master.slike[i], True # Zdesna se spaja desna polovina panorame for i in range(srednja, n): self.master.slike[i] = self.master.slike[i], False self.master.poz = self.master.winfo_x(), self.master.winfo_y() self.master.postavi_frejm(Rucno) return # Blokiranje dugmadi i menija self.pret.config(state='disabled') self.spojd.config(state='disabled') self.meni.config(state='disabled') # Transformacija u zasebnoj niti nit = Thread(target=self.pano, args=[srednja]) nit.daemon = True nit.start() # Pretraga slika def pretrazi(self, dog=None): fajlovi = askopenfilenames(filetypes=[('Svi tipovi', '*.*')]) if not fajlovi: return # Citanje slike iz fajla for fajl in fajlovi: slika = imread(fajl) if slika is None: showerror('Грешка', 'Одабрана датотека није слика.') continue # Eventualno vertikalno skracivanje dim = slika.shape[1], slika.shape[0] if dim[1] > 550: dim = round(dim[0] * 550 / dim[1]), 550 # Eventualno horizotalno skracivanje if dim[0] > 800: dim = 800, round(dim[1] * 800 / dim[0]) # Prikaz ucitane slike i njeno dodavanje # u spisak naziva ucitanih datoteka imshow(f'Pregled slike {len(self.fajlovi)+1}', resize(slika, dim)) self.master.slike.append(slika) self.fajlovi.append(fajl[fajl.rfind('/') + 1:]) # Popunjavanje kutijice sa fajlovima self.osvezi() # Popunjavanje kutijice sa fajlovima def osvezi(self): self.kutijica.config(state='normal') self.kutijica.delete(1.0, 'end') self.kutijica.insert('end', '\n'.join(self.fajlovi)) self.kutijica.config(state='disabled') # Ponistavanje poslednjeg unosa def restart(self, dog=None): if not self.master.slike: return self.master.slike.pop() self.fajlovi.pop() self.osvezi()
class PytubeGUI: """ Minimalist GUI for pytube """ def __init__(self, root): self.master = root self.master.title("PyTube-GUI") self.master.iconbitmap("pylogo.ico") self.master.geometry("450x125") self.master.minsize(width=450, height=125) self.master.resizable(width=True, height=False) (width_offset, height_offset) = self.get_offsets() self.master.geometry(f"+{width_offset}+{height_offset}") self.master.update() #Widgets self.mode = StringVar(self.master) self.mode.set("Video + Audio") self.link_entry_x_scroll = Scrollbar( self.master, orient="horizontal" ) self.link_entry = Entry( self.master, font="Sans_Serif 12", xscrollcommand=self.link_entry_x_scroll.set ) self.link_entry_x_scroll.config(command=self.link_entry.xview) self.mode_menu = OptionMenu( self.master, self.mode, "Video + Audio", "Audio Only", "HQ" ) self.mode_menu.config(width=12) self.mode_label = Label( self.master, text="Mode:", font="Sans_Serif 10", ) self.status_label = Label( self.master, text="Ready", font="Sans_Serif 12", padx=10, relief="sunken" ) self.link_entry_button = Button( self.master, text="Submit", width=15, command=self.submit ) self.dir_entry_x_scroll = Scrollbar( self.master, orient="horizontal" ) self.dir_entry = Entry( self.master, font="Sans_Serif 12", xscrollcommand=self.dir_entry_x_scroll.set ) self.dir_entry_x_scroll.config(command=self.dir_entry.xview) self.dir_entry_button = Button( self.master, text="Select Directory", width=15, command=self.dir_select ) #HQ mode widgets: self.stream_list_y_scroll = Scrollbar( self.master, orient="vertical" ) self.stream_list = Listbox( self.master, yscrollcommand=self.stream_list_y_scroll.set ) self.stream_list_y_scroll.config(command=self.stream_list.yview) self.stream_selection = StringVar(self.master) #Layout: self.master.columnconfigure(0, weight=1) self.master.rowconfigure(5, weight=1) self.link_entry.grid(row=0, column=0, sticky="ew") self.link_entry_x_scroll.grid(row=1, column=0, sticky="ew") self.link_entry_button.grid(row=0, column=1) self.mode_label.grid(row=1, column=1, sticky="ew") self.mode_menu.grid(row=2, column=1) self.status_label.grid(row=2, column=0) self.dir_entry.grid(row=3, column=0, sticky="ew") self.dir_entry_x_scroll.grid(row=4, column=0, sticky="ew") self.dir_entry_button.grid(row=3, column=1) #Bindings, Traces, Protocols: self.link_entry.bind("<Return>", self.submit) self.stream_list.bind("<Return>", self.update_stream_selection) self.stream_list.bind("<Double-Button-1>", self.update_stream_selection) self.mode.trace("w", self.set_gui) self.master.bind("<Control-w>", self.close) self.master.protocol("WM_DELETE_WINDOW", self.close) #Probe ffmpeg: self.ffmpeg = which("ffmpeg") if not self.ffmpeg: messagebox.showwarning( "Error", "Unable to probe ffmpeg.\n\n"\ "HQ & Audio Only most likely will not function "\ "correctly without ffmpeg.exe on the system path." ) self.mode_menu.config(state="disabled") def __str__(self): """ Pretty print self w/ address """ return f"PyTube-GUI @ {hex(id(self))}" def set_gui(self, *args): """ Swap between GUI layouts (Stream list / No stream list) """ if self.mode.get() == "HQ": self.master.resizable(width=True, height=True) self.master.geometry("450x250") self.stream_list.grid(row=5,column=0, columnspan=2, sticky="nsew") self.master.resizable(width=True, height=False) else: self.master.resizable(width=True, height=True) self.master.geometry("450x125") self.stream_list.grid_remove() self.master.resizable(width=True, height=False) def hq_download(self, yt_vid, directory): """ Slower download rate on average, higher resolution + ffmpeg zip """ self.update_status_label("Select Stream") self.stream_list.delete(0,"end") streams = yt_vid.streams.filter( adaptive=True, type="video", subtype="mp4" ) for stream in streams: self.stream_list.insert("end",stream) self.master.update() self.master.wait_variable(self.stream_selection) if self.stream_selection.get() == "__NONE__": return self.stream_selection.get() itag = findall("itag=\"\d*\"", self.stream_selection.get()) itag = sub("itag=\"|\"","",itag[0]) hq_stream = yt_vid.streams.get_by_itag(itag) path = directory + "/" + clean_file_name(unescape(hq_stream.title)) + ".mp4" (filename, full_path) = name_file(path) #Try to get video stream first: hq_path = None try: hq_path = hq_stream.download(directory, filename=filename+" VIDEO") except Exception as err: messagebox.showwarning("Error", err) #If we have the video stream, then go for the audio as well: audio_path = None if hq_path: try: audio_path = yt_vid \ .streams \ .filter(only_audio=True, subtype="mp4") \ .order_by("abr") \ .desc() \ .first() \ .download(directory, filename=filename+" AUDIO") except Exception as err: messagebox.showwarning("Error", err) #If we get here with both, zip them: if hq_path and audio_path: run([ f"ffmpeg", "-i", hq_path, "-i", audio_path, "-codec", "copy", full_path ]) run(["del", hq_path],shell=True) run(["del", audio_path],shell=True) def download(self, yt_vid, directory): """ Quicker download, lower resolution """ stream = yt_vid.streams.filter( progressive="True", file_extension="mp4" ).first() path = directory + "/" + clean_file_name(unescape(stream.title)) + ".mp4" (filename, full_path) = name_file(path) try: stream.download(directory, filename=filename) except Exception as err: messagebox.showwarning("Error", err) else: if self.mode.get() == "Audio Only": #Audio only streams download rather slowly via pytube, #therefore, we take the audio in place w/ pydub: self.update_status_label("Extracting Audio...") audio = AudioSegment.from_file(full_path) audio.export(full_path, format="mp4") def disabled_ui(fn): """ Wrapper for submit() that prevents accidental repeat downloads. If we spam click submit, we'll end up with a bunch of duplicates, which probably isn't desirable. """ @wraps(fn) def inner(self, *args, **kwargs): self.link_entry_button.config(state="disabled") fn(self, *args, **kwargs) self.update_status_label("Ready") self.stream_list.delete(0,"end") self.link_entry.delete(0, "end") self.link_entry_button.config(state="normal") return inner @disabled_ui def submit(self): """ Controller/handler for download() & hq_download() """ if not self.link_entry.get(): return if not url(self.link_entry.get()): messagebox.showwarning( "Invalid Input", "Input is not a valid URL." ) self.link_entry.selection_range(0,"end") return self.update_status_label("Fetching") try: yt_vid = YouTube(self.link_entry.get()) except KeyError as err: return messagebox.showwarning("KeyError", err) except Exception as err: #Same as above, capture & return return messagebox.showwarning( "Invalid Link", f"Unable to fetch video.\n{err}" ) yt_vid.register_on_progress_callback(self.progress) directory = self.dir_entry.get() or self.dir_select() if not directory: self.update_status_label("Ready") return if not exists(directory): return messagebox.showwarning( "Invalid Path", "The specified directory cannot be found." ) if self.mode.get() == "HQ": self.hq_download(yt_vid, directory) else: self.download(yt_vid, directory) def close(self, event=None): """ Callback for window close, satisfies wait_variable() before killing the application. """ self.stream_selection.set("__NONE__") raise SystemExit def update_stream_selection(self,*args): """ Callback for Double-Click / Enter key on stream_list. Serves to unblock wait_variable in hq_download() """ self.stream_selection.set( self.stream_list.get(self.stream_list.curselection()) ) def dir_select(self): """ A wrapper for askdirectory() that populates the GUI. """ directory = askdirectory() if directory: self.dir_entry.delete(0, "end") self.dir_entry.insert(0, directory) return directory def update_status_label(self, status): """ DRYs up two function calls, adds some dynamic behavior. """ self.status_label.config(text=status) self.status_label.update() def progress(self, stream, chunk, bytes_remaining): """ Callback for download progress """ dl_progress = round( (100*(stream.filesize - bytes_remaining)) / stream.filesize, 2 ) self.update_status_label(f"Downloading... {dl_progress} %") def get_offsets(self): """ Returns an appropriate offset for a given tkinter toplevel, such that it always is created center screen on the primary display. """ width_offset = int( (self.master.winfo_screenwidth() / 2) - (self.master.winfo_width() / 2) ) height_offset = int( (self.master.winfo_screenheight() / 2) - (self.master.winfo_height() / 2) ) return (width_offset, height_offset)
def aes_page(): clear_screen(mainframe) global plaintext_input, key_size, cipher_mode, ciphertext_file, key_file, plaintext_input_error, key_file_error, cipher_mode_error, ciphertext_file_error, success # ? Tkinter Variables # * create a tkinter variable called cipher_mode cipher_mode = StringVar(root) # * create a tkinter variable called key_size key_size = StringVar(root) # * create a tkinter variable called ciphertext_file ciphertext_file = StringVar(root) # * createa tkinter variable called key_file key_file = StringVar(root) # ? # ? Choices # * dictionary with different choices of cipher_mode cipher_mode_choices = {'ECB', 'CBC', 'CFB', 'OFB'} # * dictionary with different choices of key_size key_size_choices = {'128', '192', '256'} # ? # ? Setting default value in dropdown # set default values of key_size and cipher_mode cipher_mode.set('CBC') key_size.set('192') # ? # ? Title Label( mainframe, text="AES", font=h1_font, bg=main_colour).grid(row=0, column=0, columnspan=5) # ? # ? Plaintext Frame plaintext_frame = Frame(mainframe, bg=main_colour) plaintext_frame.grid(row=1, column=0, rowspan=4) Label( plaintext_frame, text="Plaintext:", font=h2_font, background=main_colour).grid(row=0, column=0, padx=10, pady=10) plaintext_input = Text( plaintext_frame, width=box_width, height=10, font=h3_font, relief="solid") plaintext_input.grid(row=1, column=0, padx=10, pady=10) # ? # ? Key Frame key_frame = Frame(mainframe, bg=main_colour) key_frame.grid(row=1, column=1, rowspan=2) Label( key_frame, text="Key File:", font=h2_font, background=main_colour, width=box_width).grid(row=0, column=1, columnspan=2) key_file_label = Label( key_frame, text="", font=h3_font, background=main_colour) key_file_label.grid(row=1, column=1, padx=10, pady=10, columnspan=2) Button( key_frame, text="Choose A File", font=(font_family, 12), background=button_colour2, command=lambda: Topic3.choose_file(key_file, key_file_label)).grid( row=2, column=1, padx=10, pady=10) Button( key_frame, text="Create A File", font=(font_family, 12), background=button_colour2, command=lambda: Topic3.create_file(key_file, key_file_label)).grid( row=2, column=2, padx=10, pady=10) # ? # ? Ciphertext Frame ciphertext_frame = Frame(mainframe, bg=main_colour) ciphertext_frame.grid(row=1, column=3, rowspan=2) Label( ciphertext_frame, text="Ciphertext File:", font=h2_font, background=main_colour, width=box_width).grid(row=0, column=0, columnspan=2) ciphertext_file_label = Label( ciphertext_frame, text="", font=h3_font, background=main_colour) ciphertext_file_label.grid( row=1, column=0, padx=10, pady=10, columnspan=2) Button( ciphertext_frame, text="Choose A File", font=(font_family, 12), background=button_colour2, command=lambda: Topic3.choose_file(ciphertext_file, ciphertext_file_label)).grid( row=2, column=0, padx=20, pady=10) Button( ciphertext_frame, text="Create A File", font=(font_family, 12), background=button_colour2, command=lambda: Topic3.create_file(ciphertext_file, ciphertext_file_label)).grid( row=2, column=1, padx=20, pady=10) # ? # ? Key Mode Frame key_mode_frame = Frame(mainframe, bg=main_colour) key_mode_frame.grid(row=3, column=1) Label( key_mode_frame, text="Cipher Mode:", font=h2_font, background=main_colour).grid(row=0, column=0) cipher_mode_option = OptionMenu( key_mode_frame, cipher_mode, *cipher_mode_choices) cipher_mode_option.config(bg=button_colour2, relief="solid") cipher_mode_option.grid(row=0, column=1, padx=10, pady=10) # ? # ? Key Size Frame key_size_frame = Frame(mainframe, bg=main_colour) key_size_frame.grid(row=4, column=1) Label( key_size_frame, text="Key Size:", font=h2_font, background=main_colour).grid(row=0, column=0) key_size_option = OptionMenu( key_size_frame, key_size, *key_size_choices) key_size_option.config(bg=button_colour2, relief="solid") key_size_option.grid(row=0, column=1, padx=10, pady=10) # ? # ? Buttons Frame button_frame = Frame(mainframe, bg=main_colour) button_frame.grid(row=5, column=1) Button( button_frame, text="Encrypt", font=(font_family, 12), background=button_colour, command=lambda: Topic3.encrypt_data()).grid( row=1, column=1, padx=10, pady=10) Button( button_frame, text="Decrypt", font=(font_family, 12), background=button_colour, command=lambda: Topic3.decrypt_data()).grid( row=1, column=2, padx=10, pady=10) # ? # ? Errors Frame error_frame = Frame(mainframe, bg=main_colour) error_frame.grid(row=6, column=1) plaintext_input_error = Label( error_frame, text="", font=error_font, fg="red", background=main_colour) plaintext_input_error.grid(row=0, column=0) key_file_error = Label( error_frame, text="", font=error_font, fg="red", background=main_colour) key_file_error.grid(row=1, column=0) ciphertext_file_error = Label( error_frame, text="", font=error_font, fg="red", background=main_colour) ciphertext_file_error.grid(row=2, column=0) cipher_mode_error = Label( error_frame, text="", font=error_font, fg="red", background=main_colour) cipher_mode_error.grid(row=3, column=0) # ? # ? Response Frame response_frame = Frame(mainframe, bg=main_colour) response_frame.grid(row=7, column=1) success = Label( response_frame, text="", font=(font_family, 13, 'bold'), background=main_colour ) success.grid(row=0, column=0, pady=5)
def __init__(self, pipepanel, pipeline_name, *args, **kwargs) : PipelineFrame.__init__(self, pipepanel, pipeline_name, *args, **kwargs) self.info = None eframe = self.eframe = LabelFrame(self,text="Options") #,fg=textLightColor,bg=baseColor) eframe.grid( row=5, column=1, sticky=W, columnspan=7, padx=10, pady=5 ) label = Label(eframe,text="Pipeline")#,fg=textLightColor,bg=baseColor) label.grid(row=3,column=0,sticky=W,padx=10,pady=5) PipelineLabels=["CellRanger","Initial/QC","Clustering","Multi-Sample Clustering" ] Pipelines=["cellranger","scrnaseqinit","scrnaseqcluster", "scrnaseqmulticluster"] self.label2pipeline = { k:v for k,v in zip(PipelineLabels, Pipelines)} PipelineLabel = self.PipelineLabel = StringVar() self.Pipeline = StringVar() PipelineLabel.set(PipelineLabels[0]) om = OptionMenu(eframe, PipelineLabel, *PipelineLabels, command=self.option_controller) om.config()#bg = widgetBgColor,fg=widgetFgColor) om["menu"].config()#bg = widgetBgColor,fg=widgetFgColor) #om.pack(side=LEFT,padx=20,pady=5) om.grid(row=3,column=1,sticky=W,padx=10,pady=5) self.crOpts = crOpts = LabelFrame( eframe, text="CellRanger Settings" ) self.scrCRID = scrCRID = StringVar() scrCRID.set("SPECIFY_PREFIX_HERE") self.scrExpected = scrExpected = StringVar() scrExpected.set("3000") scrcridL = Label(crOpts, text="CellRanger Sample ID: ") scrcridE = Entry(crOpts, bd =2, width=25, textvariable=scrCRID) scrcridL.grid(row=9,column=1,sticky=W,padx=10,pady=5) scrcridE.grid(row=9,column=2,sticky=W,padx=0,pady=5) screxpectedL = Label(crOpts, text="Expected number of cells: ") screxpectedE = Entry(crOpts, bd =2, width=8, textvariable=scrExpected) screxpectedL.grid(row=10,column=1,sticky=W,padx=10,pady=5) screxpectedE.grid(row=10,column=2,sticky=W,padx=0,pady=5) self.clusterOpts = clusterOpts = LabelFrame( eframe, text="Clustering and tSNE Options" ) self.scrPCs = scrPCs = StringVar() scrPCs.set("12") self.scrRes = scrRes = StringVar() scrRes.set("0.6") #scrPCs.trace('w', lambda a,b,c,x="scrPCs": makejson(x)) #Filter out genes < [5] read counts in < [2] samples scrpcsL = Label(clusterOpts, text="Include principal components 1 through ") scrpcsE = Entry(clusterOpts, bd =2, width=3, textvariable=scrPCs) scrresL = Label(clusterOpts, text="with clustering resolution: ") scrresE = Entry(clusterOpts, bd =2, width=3, textvariable=scrRes) scrpcsL.grid(row=9,column=1,sticky=W,padx=10,pady=5) scrpcsE.grid(row=9,column=2,sticky=W,padx=0,pady=5) scrresL.grid(row=9,column=3,sticky=W,padx=5,pady=5) scrresE.grid(row=9,column=4,sticky=W,padx=0,pady=5) #scrRes.trace('w', lambda a,b,c,x="scrPCs": makejson(x)) clusterOpts.grid( row=8, column=0, columnspan=4, sticky=W, padx=20, pady=10 ) self.multiclusterOpts = multiclusterOpts = LabelFrame( eframe, text = "Multi-Sample Clustering and tSNE Options") scrccsL = Label(multiclusterOpts, text="Include canonical components 1 through ") scrccsE = Entry(multiclusterOpts, bd =2, width=3, textvariable=scrPCs) scrmcresL = Label(multiclusterOpts, text="with clustering resolution: ") scrmcresE = Entry(multiclusterOpts, bd =2, width=3, textvariable=scrRes) scrccsL.grid(row=9,column=1,sticky=W,padx=10,pady=5) scrccsE.grid(row=9,column=2,sticky=W,padx=0,pady=5) scrmcresL.grid(row=9,column=3,sticky=W,padx=5,pady=5) scrmcresE.grid(row=9,column=4,sticky=W,padx=0,pady=5) self.qcOpts = qcOpts = LabelFrame( eframe, text="Initial Settings" ) countL = Label( qcOpts, text="Counts/Matrix Dir:" ) countL.grid(row=9, column=1, sticky=W, padx=10, pady=5 ) countpath=StringVar() self.countpath = countpath count_entry = Entry(qcOpts, bd =2, width = 50, #bg = entryBgColor, #fg = entryFgColor, textvariable = countpath, state='normal' ) count_entry.grid( row=9, column=2, columnspan=3 ) self.count_button = count_button = Button( qcOpts, text="Open Directory", command=self.set_count_directory ) count_button.grid( row=9, column=5 ) self.mattype = mattype = StringVar() mattypeL = Label(qcOpts, text="Count matrix format: ") scrMatTypeDropdown = ["cellranger", "cellranger_raw", "zumi", "biorad"] mattype.set(scrMatTypeDropdown[0]) mattype_om = OptionMenu(qcOpts, mattype, *scrMatTypeDropdown) mattypeL.grid(row=10,column=1,sticky=W,padx=10,pady=5) mattype_om.grid(row=10,column=2,sticky=W,padx=0,pady=5) self.docycleregress = docycleregress = StringVar() docycleregressL = Label(qcOpts, text="Do cell cycle regression? ") scrCycleDropdown = ["TRUE", "FALSE"] docycleregress.set(scrCycleDropdown[0]) cycle_om = OptionMenu(qcOpts, docycleregress, *scrCycleDropdown) docycleregressL.grid(row=11,column=1,sticky=W,padx=10,pady=5) cycle_om.grid(row=11,column=2,sticky=W,padx=0,pady=5) usecycleregressL_c = Label(clusterOpts, text="Use cell cycle regressed data? ") docycleregress.set(scrCycleDropdown[0]) cycle_om_c = OptionMenu(clusterOpts, docycleregress, *scrCycleDropdown) usecycleregressL_c.grid(row=10,column=1,sticky=W,padx=10,pady=5) cycle_om_c.grid(row=10,column=2,sticky=W,padx=0,pady=5) usecycleregressL_mc = Label(multiclusterOpts, text="Use cell cycle regressed data? ") docycleregress.set(scrCycleDropdown[0]) cycle_om_mc = OptionMenu(multiclusterOpts, docycleregress, *scrCycleDropdown) usecycleregressL_mc.grid(row=10,column=1,sticky=W,padx=10,pady=5) cycle_om_mc.grid(row=10,column=2,sticky=W,padx=0,pady=5) groups_buttonL = Label(qcOpts, text="SAMPLE INFORMATION: ") groups_button = Button(qcOpts, text="Set Groups", command = self.popup_groups ) groups_buttonL.grid(row=12,column=1,sticky=W,padx=10,pady=5) groups_button.grid(row=12,column=2,sticky=W,padx=0,pady=5) ##################### self.option_controller()