def __init__(self, boss =None, r =1, lb =None): """Constructeur""" Frame.__init__(self) #héritage de la classe Frame self.labl =lb self.config(bg ='#5d5d5d') val =tix.Balloon() #liste des couleurs d'initialisation col =['white', 'black', 'red', 'green', 'blue', 'cyan', 'yellow', 'magenta'] #on récupère la couleur en fonction du nombre de bouton appelé self.color =col[r%8] # On cré le widget permettant de saisir la direction de la fourmis self.direction =ttk.Combobox(boss, values =['->', '<-'], width =10) self.direction.current(r%2) val.bind_widget(widget =self.direction, msg="Sélectionner une direction") self.direction.grid(row =r, column =2, padx =2, pady =5) # bouton pour sélectionner la couleur self.b =Button(boss, text ='color', command =self.getColor, bg =self.color, activebackground =self.color) val.bind_widget(widget =self.b, msg="Sélectionner une couleur") # si la couleur est noir on affiche le texte en blanc if self.color == 'black' or self.color == '#000000': self.b.config(fg ='white') else: self.b.config(fg ='black') self.b.grid(row =r, column =1, padx =2, pady =5)
def creercadresplash(self): self.cadresplash = Frame(self.root) self.canevasplash = Canvas(self.cadresplash, width=640, height=580, bg="red") self.canevasplash.pack() self.nomsplash = Entry(bg="pink") self.nomsplash.insert(0, "jmd") self.ipsplash = Entry(bg="pink") self.ipsplash.insert(0, self.monip) self.balIp = tix.Balloon(self.cadresplash, state="balloon") self.balIp.bind_widget( self.canevasplash, msg="identifiez vous et indiquez l'adresse du serveur") btnconnecter = Button(text="Connecter au serveur", bg="pink", command=self.loginclient) self.canevasplash.create_window(200, 200, window=self.nomsplash, width=100, height=30) self.canevasplash.create_window(200, 250, window=self.ipsplash, width=100, height=30) self.canevasplash.create_window(200, 400, window=btnconnecter, width=100, height=30)
def affichageAcceuil(self): self.frameAcceuil = Frame(self.root) self.canevasAcceuil = Canvas(self.frameAcceuil, width=640, height=480, bg="white") self.canevasAcceuil.pack() self.imgLogin = ImageTk.PhotoImage(file=".\login.png") self.canevasAcceuil.create_image(100, 200, image=self.imgLogin, anchor="nw") self.lblId = Label(text="Entrez un identifiant: ") self.champId = Entry(text="Gab", bg="white") self.lblOrg = Label(text="Entrez une organisation: ") self.champOrg = Entry(text="CVM", bg="white") self.champId.insert(0, "Gab") self.champOrg.insert(0, "CVM") btnconnecter = Button(text="Connexion", bg="lightgray", command=self.loginclient) self.balIp = tix.Balloon(self.frameAcceuil, state="balloon") self.balIp.bind_widget( btnconnecter, msg="identifiez vous et indiquez l'adresse du serveur") self.canevasAcceuil.create_window(225, 200, window=self.lblOrg, width=160, height=30) self.canevasAcceuil.create_window(400, 200, window=self.champOrg, width=150, height=30) self.canevasAcceuil.create_window(225, 250, window=self.lblId, width=160, height=30) self.canevasAcceuil.create_window(400, 250, window=self.champId, width=150, height=30) self.canevasAcceuil.create_window(310, 400, window=btnconnecter, width=150, height=30)
def widgets(self): "Configuration des widgets" """Info-bulle""" tip = tix.Balloon(root) """Bouton""" my_button = tkinter.Button(root, text='Clique !') my_button.pack(pady=50) """Etiquette""" my_label = tkinter.Label(root, text='Machin', font='Helvetica 20') my_label.pack(pady=20) """Bind permettant de relier l'info-bulle au bouton""" tip.bind_widget(my_button, balloonmsg="C'est une info-bulle !") """Bind permettant de relier l'info-bulle à l'étiquette""" tip.bind_widget(my_label, balloonmsg="C'est encore une putain d'info-bulle !")
def _test(): root = tix.Tk() status = ttk.Label( root, text='Status', foreground='darkblue', ) status.grid(row=0, column=0, pady=10) bal = tix.Balloon(root) s = tk.StringVar(root, 'Hello') bal.bind_widget(status, balloonmsg=s) root.mainloop()
def baloesMensagenBotoes(self): self.balao_bnt_limpar = tix.Balloon(self.aba_beneficiario) self.balao_bnt_limpar.bind_widget(self.btn_limpar_campos_formualario,balloonmsg="LIMPAR CAMPOS DIGITADOS") self.balao_btn_cadastrar = tix.Balloon(self.aba_beneficiario) self.balao_btn_cadastrar.bind_widget(self.btn_cadastrar,balloonmsg="CADASTRAR UM NOVO BENEFICIARIO") self.balao_btn_alterar = tix.Balloon(self.aba_beneficiario) self.balao_btn_alterar.bind_widget(self.btn_alterar,balloonmsg="ALTERAR DADOS DE CADASTRO DE UM BENEFICIARIO") self.balao_btn_apagar = tix.Balloon(self.aba_beneficiario) self.balao_btn_apagar.bind_widget(self.bnt_apagar,balloonmsg="APAGAR CADASTRO DE UM CLIENTE") self.balao_btn_buscar = tix.Balloon(self.aba_beneficiario) self.balao_btn_buscar.bind_widget(self.btn_buscar,balloonmsg="DIGITE NO CAMPO NOME UM BENEFICIARIO QUE DESEJA ENCONTRAR") self.balao_btn_atualizar = tix.Balloon(self.aba_beneficiario) self.balao_btn_atualizar.bind_widget(self.btn_atualizar_lista,balloonmsg="ATUALIZAR LISTA DE BENEFICIARIOS CADASTRADOS")
def makelist(self): speedBalloon = tix.Balloon(self.t) variable = {} var_variables = ['percent'] temp = rcc.variability temp.sort() labels = {} bLabel = tix.Label( self.t, text= 'Variability level between individual animals of the same creature\nPercent is assumed to be maximum variability\nIf 0 the BODY_APPEARANCE_MODIFIER tags will not be added' ) r = 0 c = 1 for key in temp: r = r + 1 variable[key] = {} if r > 12: c = c + 1 r = 1 labels[key] = tix.Label(self.t, text=key.capitalize() + ':').grid(row=r, column=c, stick=tix.W) for var in var_variables: r = r + 1 variable[key][var] = tix.Control( self.t, label=var.capitalize(), min=0, value=rcc.numbers['variable'][key][var].get(), variable=rcc.numbers['variable'][key][var], autorepeat=False) variable[key][var].subwidget('decr').destroy() variable[key][var].subwidget('incr').destroy() variable[key][var].grid(row=r, column=c, stick=tix.E, padx=10) bLabel.grid(row=0, column=0, columnspan=c) self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL) self.bb.add('close', text='Close', command=self.close) self.bb.grid(row=0, column=c + 1)
def makelist(self): speedBalloon = tix.Balloon(self.t) speed = {} speed_variables = ['max', 'min'] temp = rcc.gaits temp.sort() labels = {} bLabel = tix.Label( self.t, text= 'Speed of various gaits in kph\nChosen from a triangular distribution between Min and Max\nSee the readme for additional information' ) r = 0 c = 1 for key in temp: r = r + 1 speed[key] = {} if r > 12: c = c + 1 r = 1 labels[key] = tix.Label(self.t, text=key.capitalize() + ':').grid(row=r, column=c, stick=tix.W) for var in speed_variables: r = r + 1 speed[key][var] = tix.Control( self.t, label=var.capitalize(), min=0, value=rcc.numbers['speed'][key][var].get(), variable=rcc.numbers['speed'][key][var], autorepeat=False) speed[key][var].subwidget('decr').destroy() speed[key][var].subwidget('incr').destroy() speed[key][var].grid(row=r, column=c, stick=tix.E, padx=10) bLabel.grid(row=0, column=0, columnspan=c) self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL) self.bb.add('close', text='Close', command=self.close) self.bb.grid(row=0, column=c + 1)
def makelist(self): listBalloon = tix.Balloon(self.t) c = 0 self.cl = {} for type1 in rcc.checks[self.ty]: j = 0 self.cl[type1] = tix.CheckList(self.t, width=350, height=600, browsecmd=self.update) self.cl[type1].grid(row=0, column=c) self.cl[type1].hlist.add(type1, text=type1) self.cl[type1].setstatus(type1, rcc.status[type1]['All']) temp = list(rcc.data[type1].keys()) temp.sort() for subtype in temp: j = j + 1 hl = tix.Label(self.cl[type1], text="?") hl.place(in_=self.cl[type1], x=10, y=16 * j + 4, width=10, height=10) # hl.place_forget() self.cl[type1].hlist.add(type1 + '.' + subtype, text=subtype) self.cl[type1].setstatus(type1 + '.' + subtype, rcc.status[type1][subtype]) # print(self.cl[type].subwidgets_all()) listBalloon.bind_widget(hl, msg=''.join( rcc.store[type1][subtype])) # hl.place_forget() self.cl[type1].autosetmode() c = c + 1 self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL) self.bb.add('close', text='Close', command=self.close) self.bb.add('check', text='Check All', command=self.checkAll) self.bb.add('uncheck', text='Uncheck All', command=self.uncheckAll) self.bb.grid(row=0, column=c)
def makelist(self): argsBalloon = tix.Balloon(self.t) arg = {} arg_variables = ['max', 'min'] temp = list(rcc.args.keys()) temp.sort() labels = {} bLabel = tix.Label( self.t, text= 'All arguments found in the Templates\nWhen each creature is generated a value is chosen for each argument\nThe value is selected from a triangular distribution between Min and Max' ) r = 0 c = 1 for key in temp: r = r + 1 arg[key] = {} if r > 12: c = c + 1 r = 1 labels[key] = tix.Label(self.t, text=key.capitalize() + ':').grid(row=r, column=c, stick=tix.W) for var in arg_variables: r = r + 1 arg[key][var] = tix.Control( self.t, label=var.capitalize(), min=0, value=rcc.numbers['args'][key][var].get(), variable=rcc.numbers['args'][key][var], autorepeat=False) arg[key][var].subwidget('decr').destroy() arg[key][var].subwidget('incr').destroy() arg[key][var].grid(row=r, column=c, stick=tix.E, padx=10) bLabel.grid(row=0, column=0, columnspan=c) self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL) self.bb.add('close', text='Close', command=self.close) self.bb.grid(row=0, column=c + 1)
from tkinter import * from tkinter import tix root = Tk() status = Label(root, height = 3, width=30, bd=1,bg='yellow',wraplength = 210, text = "All angles are in degrees") status.grid(row = 0,column = 0,pady = 10) bal = tix.Balloon(root,statusbar = status) frame_1 = Frame(root,relief=RIDGE,bd = 2) frame_1.grid(row=1,column = 0) Angles = [StringVar(),StringVar()] #Incomming label_in = Label(frame_1,text = "TH_in") label_in.grid(row = 0,column = 0) entry_in = Entry(frame_1, width = 20, textvariable = Angles[0]) entry_in.grid(row = 0,column = 1) #Outgoing label_out = Label(frame_1,text = "TH_out") label_out.grid(row = 1,column = 0) entry_out = Entry(frame_1, width = 20, textvariable = Angles[1]) entry_out.grid(row=1,column=1) #tool tip / status bar bal.bind_widget(label_in,balloonmsg='Incidence Angle',statusmsg = 'Incidence angle of the incoming light with respect to the surface normal.') bal.bind_widget(label_out,balloonmsg='Detector Angle',statusmsg = 'Angle between the surface normal and the detector') root.mainloop()
def generate(): getCreature() def defaults(): rcc.fillDefaults(rcc.numbers) def close(): return canvas.create_window(0, 0, anchor=NW, window=frame) frame.update_idletasks() canvas.config(scrollregion=canvas.bbox('all')) makeNumbersTable(frame) mainBalloon = tix.Balloon(frame) templateLabel = tix.Label(frame, text='Templates') templateLabel.grid(row=0, column=0) mainBalloon.bind_widget( templateLabel, msg= 'Select which templates you wish to be considered for adding to creatures\nBy default all templates are active' ) bb = tix.ButtonBox(frame, orientation=tix.VERTICAL) bb.add('attack', text='Attacks and Interactions', command=attacks) bb.add('base', text='Body Materials', command=materials) bb.add('body', text='Body Parts (Core)', command=bodyparts) bb.add('body2', text='Body Parts (Extremities)', command=bodyparts2) bb.add('attachments', text='Body Part Attachments', command=attachments) bb.add('internal', text='Organs, Bones, and Extracts', command=internal) bb.add('face', text='Facial Features (Large)', command=face)
treeview_tree = ttk.Treeview(right_frame, height=10, show='tree') treeview_tree_parents = treeview_tree.insert('', index='end', text='结构树') for i in range(10): treeview_tree.insert(treeview_tree_parents, index='end', text=i) frame_nb1, frame_nb2 = ttk.Frame(right_frame), ttk.Frame(right_frame) notebook = ttk.Notebook(right_frame, height=200, width=200) notebook.add(frame_nb1, text='选项卡1'), notebook.add(frame_nb2, text='选项卡2') canvas = tk.Canvas(right_frame, bg='white', height=300, width=300) canvas.create_line(10, 10, 50, 30, 60, 70) canvas.bind('<B1-Motion>', paint) text = tkinter.scrolledtext.ScrolledText(bottom_frame, height=5).pack(side='left', fill='both', expand=1) balloon = tix.Balloon(right_frame) balloon.bind_widget(button_top, balloonmsg='这是一个气泡提示') popupmenu = tk.Menu(root, tearoff=0) popupmenu.add_command(label='最小化', command=root.iconify),\ popupmenu.add_command(label='退出', command=root.destroy) root.bind('<Button-3>', show_popupmenu) treeview_sheet.pack(side='left', padx=5), treeview_tree.pack(side='left', padx=5),notebook.pack(side='left',padx=5),\ canvas.pack(side='left', padx=5) root.mainloop()
def __init__(self): """Configuration de l'interface graphique et initialisation des variables""" bgColor ='#5d5d5d' textColor ='#0000FF' # Initialisation de l'interface graphique tix.Tk.__init__(self) self.title("Universal Langton Ant") self.config(bg =bgColor) val =tix.Balloon() menuBar =Menu(self) self['menu'] = menuBar sousMenu =Menu(menuBar) menuBar.add_cascade(label='File', menu=sousMenu) sousMenu.add_command(label='Open rule', command=self.chargeData) sousMenu.add_command(label='Save rule', command=self.saveRule) sousMenu.add_command(label='Export to png', command=self.export) # bouton de remise à zéros de la fourmis self.btRAZ =Button(self, text ='R.A.Z', width =10, command =self.RAZ, bg =bgColor, fg =textColor) val.bind_widget(widget =self.btRAZ, msg="Remise à zéros de la grille") self.btRAZ.grid(row =1, column =3, pady =5) # Création du label pour conter les étapes self.stepCounter =0 self.LBstepCounter =Label(self, text ='Step: 0', bg =bgColor, fg =textColor) self.LBstepCounter.grid(row =1, column =1, columnspan =2) # Varialbes utiles a la gestion du programme self.runFlag =False # Création de la fourmis self.antCanvas =LangtonAnt() self.antCanvas.grid(row =2, column =1, rowspan =8, columnspan =7, padx =5) # Création du bouton de démarrage de la fourmis self.BtStart =Button(self, text ='Start', command =self.start, width =10, bg =bgColor, fg =textColor) val.bind_widget(widget =self.BtStart, msg="Lancer l'algorithme") self.BtStart.grid(row =10, column =2, pady =5) #Création du bouton d'arrêt de la fourmis self.BtStop =Button(self, text ='Stop', command =self.stop, width =10, bg =bgColor, fg =textColor) self.BtStop.grid(row =10, column =3, pady =5) # Création du check button pour passer en mode pas à pas self.stepFlag =IntVar() self.CkStep =Checkbutton(self, variable =self.stepFlag, command =self.changeStepParam, width =3, bg =bgColor, fg =textColor) val.bind_widget(widget =self.CkStep, msg="Activer le mode pas à pas") self.CkStep.grid(row =10, column =4, pady =5) # Création du bouton pour le mode pas à pas self.BtStep =Button(self, text ="Step", state =DISABLED, command =self.move, width =10, bg =bgColor, fg =textColor) val.bind_widget(widget =self.BtStep, msg="Avancer d'une étape") self.BtStep.grid(row =10, column =5, pady =5) # Partie de la configuration des règles Label(self, text ="Rule configuration", bg =bgColor, fg =textColor).grid(row =1, column =7, columnspan =3) # Création pour enlever une règles self.BtLess =Button(self, text ='-', command =self.suppRule, bg =bgColor, fg =textColor) val.bind_widget(widget =self.BtLess, msg="Supprimer une règle") self.BtLess.grid(row =2, column =8) # Création de d'une zone de saisie pour modifier le nombre de règles self.LbNumberRule =Label(self, text ='2', width =10, bg =bgColor, fg =textColor) self.LbNumberRule.grid(row =2, column =9, padx =5) # Création du bouton pour ajouter une règle self.BtPlus =Button(self, text ='+', command =self.addRule, bg =bgColor, fg =textColor) val.bind_widget(widget =self.BtPlus, msg="Ajouter une règle") self.BtPlus.grid(row =2, column =10) # Bouton pour généré les boutons pour définir les règles self.BtGenerate =Button(self, text ='Generate', width =13, command =self.generateRule, bg =bgColor, fg =textColor) val.bind_widget(widget =self.BtGenerate, msg="Générer les règles") self.BtGenerate.grid(row =3, column =8, columnspan =3, padx =5, pady =5) # Création d'un label pour informé l'utilisateur de la mise à jour des règles self.LbRule =Label(self, text ='You can start', fg ='#3FFF00', bg =bgColor) self.LbRule.grid(row =10, column =8, columnspan =4, pady =5) # Scroll barre pour les widgets RuleWidget vsb = Scrollbar(self, orient=VERTICAL) vsb.grid(row=4, column=11, rowspan =5, sticky=N+S) # Canvas pour les widgets RuleWidget self.ruleCan =Canvas(self, yscrollcommand=vsb.set, width =130, height =300, bg =bgColor) self.ruleCan.grid(row =4, column =8, columnspan =3, rowspan =5) vsb.config(command=self.ruleCan.yview) # Frame pour les widgets RuleWidget self.ruleFrame =Frame(self.ruleCan) self.ruleList=[] #liste pour contenir les paramètres des règles # Création de 2 RuleWidgets for i in range(0, 2): widget =RuleWidget(boss =self.ruleFrame, r =i, lb =self.LbRule) self.ruleList.append(widget) # Configuration du canvas self.ruleCan.create_window(0, 0, window=self.ruleFrame) self.ruleFrame.update_idletasks() self.ruleCan.config(scrollregion=self.ruleCan.bbox("all"))
error_label = ConfigLabel(preset_frame, '') error_label.label.pack(side='right') preset_frame.pack(side='top', fill='x') config_frame = tk.Frame(root) row_label, row_entry = ConfigLabel(config_frame, 'Rows: '), ConfigEntry(config_frame) column_label, column_entry = ConfigLabel( config_frame, 'Columns: '), ConfigEntry(config_frame) mines_label, mines_entry = ConfigLabel(config_frame, 'Mines: '), ConfigEntry(config_frame) config_confirm = ConfigConfirm(config_frame, 'Generate', False, row_entry, column_entry, mines_entry) config_frame.pack(side='top', fill='x') tooltip = tkx.Balloon(root, initwait=750, bg=defaultbg) tooltip.bind_widget(demo_size.button, balloonmsg='Rows: 10, Columns: 10, Mines: 5') tooltip.bind_widget(beginner_size.button, balloonmsg='Rows: 9, Columns: 9, Mines: 10') tooltip.bind_widget(intermediate_size.button, balloonmsg='Rows: 16, Columns: 16, Mines: 40') tooltip.bind_widget(expert_size.button, balloonmsg='Rows: 16, Columns: 30, Mines: 99') tooltip.bind_widget(row_entry.entry, balloonmsg='Amount of horizontal rows.\nMaximum of 18.') tooltip.bind_widget(column_entry.entry, balloonmsg='Amount of vertical columns.\nMaximum of 34.') tooltip.bind_widget( mines_entry.entry, balloonmsg='Amount of mines on the field.\nMaximum of 612.')
def widgets_frame1(self): self.abas = ttk.Notebook(self.frame_1) self.aba1 = Frame(self.abas) self.aba2 = Frame(self.abas) self.aba1.configure(background= "#dfe3ee") self.aba2.configure(background= "lightgray") self.abas.add(self.aba1, text = "Aba 1") self.abas.add(self.aba2, text="Aba 2") self.abas.place(relx=0, rely=0, relwidth=0.98, relheight=0.98) self.canvas_bt = Canvas(self.aba1, bd=0, bg='#1e3743', highlightbackground = 'gray', highlightthickness=5) self.canvas_bt.place(relx= 0.19, rely= 0.08, relwidth= 0.22, relheight=0.19) ### Criação do botao limpar self.bt_limpar = Button(self.aba1, text= "Limpar", bd=2, bg = '#107db2',fg = 'white', activebackground='#108ecb', activeforeground="white" , font = ('verdana', 8, 'bold'), command= self.limpa_cliente) self.bt_limpar.place(relx= 0.2, rely=0.1, relwidth=0.1, relheight= 0.15) ### Criação do botao buscar self.bt_buscar = Button(self.aba1, text="Buscar", bd=2, bg = '#107db2',fg = 'white' , font = ('verdana', 8, 'bold'), command = self.busca_cliente) self.bt_buscar.place(relx=0.3, rely=0.1, relwidth=0.1, relheight=0.15) texto_balao_buscar = "Digite no campo nome o cliente que deseja pesquisar" self.balao_buscar = tix.Balloon(self.aba1) self.balao_buscar.bind_widget(self.bt_buscar, balloonmsg = texto_balao_buscar) ### Criação do botao novo ## imgNovo self.btnovo = PhotoImage(data=base64.b64decode(self.btnovo_base64)) self.btnovo = self.btnovo.subsample(2, 2) self.bt_novo = Button(self.aba1, bd =0, image = self.btnovo, command= self.add_cliente) self.bt_novo.place(relx=0.55, rely=0.1, width=60, height=30) ### Criação do botao alterar self.btalterar = PhotoImage(data=base64.b64decode(self.btalterar_base64)) self.btalterar = self.btalterar.subsample(2, 2) self.bt_alterar = Button(self.aba1, image = self.btalterar, bd=0, command=self.altera_cliente) self.bt_alterar.place(relx=0.67, rely=0.1, width=60, height=30) ### Criação do botao apagar self.bt_apagar = Button(self.aba1, text="Apagar", bd=2, bg = '#107db2',fg = 'white' , font = ('verdana', 8, 'bold'), command=self.deleta_cliente) self.bt_apagar.place(relx=0.8, rely=0.1, relwidth=0.1, relheight=0.15) ## Criação da label e entrada do codigo self.lb_codigo = Label(self.aba1, text = "Código", bg= '#dfe3ee', fg = '#107db2') self.lb_codigo.place(relx= 0.05, rely= 0.05 ) self.codigo_entry = Entry(self.aba1) self.codigo_entry.place(relx= 0.05, rely= 0.15, relwidth= 0.08) ## Criação da label e entrada do nome self.lb_nome = Label(self.aba1, text="Nome", bg= '#dfe3ee', fg = '#107db2') self.lb_nome.place(relx=0.05, rely=0.35) self.nome_entry = Entry(self.aba1) self.nome_entry.place(relx=0.05, rely=0.45, relwidth=0.8) ## Criação da label e entrada do telefone self.lb_nome = Label(self.aba1, text="Telefone", bg= '#dfe3ee', fg = '#107db2') self.lb_nome.place(relx=0.05, rely=0.6) self.fone_entry = Entry(self.aba1) self.fone_entry.place(relx=0.05, rely=0.7, relwidth=0.4) ## Criação da label e entrada da cidade self.lb_nome = Label(self.aba1, text="Cidade", bg= '#dfe3ee', fg = '#107db2') self.lb_nome.place(relx=0.5, rely=0.6) self.cidade_entry = Entry(self.aba1) self.cidade_entry.place(relx=0.5, rely=0.7, relwidth=0.4) #### drop down button self.Tipvar = StringVar() self.TipV = ("Solteiro(a)", "Casado(a)", "Divorciado(a)", "Viuvo(a)") self.Tipvar.set("Solteiro(a)") self.popupMenu = OptionMenu(self.aba2, self.Tipvar, *self.TipV) self.popupMenu.place(relx= 0.1, rely=0.1, relwidth=0.2, relheight=0.2) self.estado_civil = self.Tipvar.get() print(self.estado_civil)
def makelist(self): advBalloon = tix.Balloon(self.t) r = 0 c = 0 attribute = {} attribute_variables = ['max', 'min', 'sigma'] temp = rcc.phys_attributes temp.sort() labels = {} labels['Phys_Atts'] = tix.Label(self.t, text='Physical\nAttributes') labels['Phys_Atts'].grid(row=r, column=c) for key in temp: r = r + 1 attribute[key] = {} labels[key] = tix.Label(self.t, text=key.capitalize() + ':').grid(row=r, column=c, stick=tix.W) for var in attribute_variables: r = r + 1 attribute[key][var] = tix.Control( self.t, label=var.capitalize(), min=0, value=rcc.numbers['attributes'][key][var].get(), variable=rcc.numbers['attributes'][key][var], autorepeat=False) attribute[key][var].subwidget('decr').destroy() attribute[key][var].subwidget('incr').destroy() attribute[key][var].grid(row=r, column=c, stick=tix.E, padx=10) advBalloon.bind_widget( labels['Phys_Atts'], msg= 'Physical attribute tokens [PHYS_ATT_RANGE:STRENGTH:a:b:c:d:e:f:g] are calculated as follows:\n a is taken from a gaussian distribution with mean Min and sigma Sigma\n g is taken from a gaussian distribution with mean Max and sigma Sigma\n d = (a+g)/2\n c/e = d -/+ 2*(g-d)/10\n b/f = d -/+ 5*(g-d)/10\nIf Max is 0 then the attribute token is not added to the creature' ) r = 0 c = 1 temp = rcc.ment_attributes temp.sort() labels = {} for key in temp: r = r + 1 if r >= 23: r = 1 c += 1 attribute[key] = {} labels[key] = tix.Label(self.t, text=key.capitalize() + ':').grid(row=r, column=c, stick=tix.W) for var in attribute_variables: r = r + 1 attribute[key][var] = tix.Control( self.t, label=var.capitalize(), min=0, value=rcc.numbers['attributes'][key][var].get(), variable=rcc.numbers['attributes'][key][var], autorepeat=False) attribute[key][var].subwidget('decr').destroy() attribute[key][var].subwidget('incr').destroy() attribute[key][var].grid(row=r, column=c, stick=tix.E, padx=10) labels['Ment_Atts'] = tix.Label(self.t, text='Mental\nAttributes') labels['Ment_Atts'].grid(row=0, column=1, columnspan=c) advBalloon.bind_widget( labels['Ment_Atts'], msg= 'Mental attribute tokens [MENT_ATT_RANGE:WILLPOWER:a:b:c:d:e:f:g] are calculated as follows:\n a is taken from a gaussian distribution with mean Min and sigma Sigma\n g is taken from a gaussian distribution with mean Max and sigma Sigma\n d = (a+g)/2\n c/e = d -/+ 2*(g-d)/10\n b/f = d -/+ 5*(g-d)/10\nIf Max is 0 then the attribute token is not added to the creature' ) self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL) self.bb.add('close', text='Close', command=self.close) self.bb.grid(row=0, column=c + 1)
font=("arial", 18, "bold"), width=10, bg='SpringGreen2', activebackground='red', command=f18) time() lblCity = Label(root, text="City :", font=("Gadugi", 18, "bold")).place(x=40, y=540) c = f15() lblCity1 = Label(root, text=c, font=('Segoe Script', 15, 'bold'), fg='dark slate blue', wraplength=1000).place(x=150, y=540) balloon = tix.Balloon(root) # bind balloon to buttons balloon.bind_widget(btnAdd, balloonmsg='Click to Add Records') balloon.bind_widget(btnView, balloonmsg='Click to View Records') balloon.bind_widget(btnUpdate, balloonmsg='Click to Update Records') balloon.bind_widget(btnDelete, balloonmsg='Click to Delete Records') balloon.bind_widget(btnGraph, balloonmsg='Click to see Graph') balloon.bind_widget(btnEmail, balloonmsg='Click to send Email') #lbltitle.pack(pady=10) btnAdd.pack(pady=10) btnView.pack(pady=10) btnUpdate.pack(pady=10) btnDelete.pack(pady=10) btnGraph.pack(pady=10) btnEmail.pack(pady=10)
def __init__(self, maintk, frame, section, parameter_file, button_file, cfg_file, initial_file): """ This function sets all needed configurations of one Page of the Notebook. Attributes ---------- maintk : the main tkinter link frame : the tkinter frame of the page which is reserved for this section section : the section of this notebook page parameter_file : path to the parameter file button_file : path to the button file cfg_file : path to the config file initial_file : path to the initial values file """ self.root = frame self.maintk = maintk self.root.protocol = maintk.protocol self.root.title = maintk.title self.root.geometry = maintk.geometry self.maintk.protocol('WM_DELETE_WINDOW', self.exit_window) self.section = section self.parameter_file = parameter_file self.button_file = button_file self.cfg_file = cfg_file self.data = self.get_data() if initial_file is not None: cp = configparser.ConfigParser() cp.optionxform = str cp.read(initial_file) for key in cp[self.section]: val = eval(cp[self.section][key]) self.data[key][0] = val self.root.columnconfigure(0, weight=0) self.root.columnconfigure(1, weight=1) self.root.columnconfigure(2, weight=0) screen_width = self.root.winfo_screenwidth() screen_height = self.root.winfo_screenheight() gui_width = 500 gui_height = 100 + 30 * len(self.data) if gui_width > screen_width: gui_width = screen_width if gui_height > screen_height: gui_height = screen_height self.maintk.geometry('{}x{}'.format(gui_width, gui_height)) x_position = int(screen_width / 2 - gui_width / 2) y_position = int(screen_height / 2 - gui_height / 2) self.maintk.geometry('+{}+{}'.format(x_position, y_position)) self.display() tooltip = tix.Balloon(self.root) tooltip.subwidget('label').forget() tooltip.message.config(bg="gray95", fg="black") for subwidgets in tooltip.subwidgets_all(): subwidgets.configure(bg='gray95') for entry in self.entries: tooltip.bind_widget(self.entries[entry]['entry'], balloonmsg=self.data[entry][2]) self.root.bind("<<NotebookTabChanged>>", self.on_tab_switch)
window = tix.Tk() window.configure(background="#baffde") label = [] pb = [] Hlabel = [] Mlabel = [] indicatelabel=[] choosebtn=[] skillbtn=[] c = 0 bal=tix.Balloon(window) PNUM=3 for i in range(1,PNUM*3+1 , 3): if c == 0: label.append(Label(window, text=("player",c+1),fg="blue", bg="#baffde", font="none 10")) pb.append(ttk.Progressbar(window, style="Horizontal.TProgressbar", orient='horizontal', length=200,mode='determinate', maximum=200, value=200)) elif c == 1: label.append(Label(window, text=("player",c+1),fg="red", bg="#baffde", font="none 10")) pb.append(ttk.Progressbar(window, style="Horizontal.TProgressbar", orient='horizontal', length=200, mode='determinate', maximum=200, value=200)) elif c == 2: label.append(Label(window, text=("player",c+1),fg="green", bg="#baffde", font="none 10")) pb.append(ttk.Progressbar(window, style="Horizontal.TProgressbar", orient='horizontal', length=200, mode='determinate', maximum=200, value=200)) elif c == 3: label.append(Label(window, text=("player",c+1),fg="purple", bg="#baffde", font="none 10"))
def makeNumbersTable(frame): numbersSubFrame = tix.Frame(frame) numbersSubFrame.rowconfigure(1) numbersSubFrame.columnconfigure(1) numbersBalloon = tix.Balloon(numbersSubFrame) rcc.numbers['args'] = {} for key in rcc.args: rcc.numbers['args'][key] = {} rcc.numbers['args'][key]['max'] = tix.IntVar() rcc.numbers['args'][key]['min'] = tix.IntVar() rcc.numbers['speed'] = {} for key in rcc.gaits: rcc.numbers['speed'][key] = {} rcc.numbers['speed'][key]['max'] = tix.IntVar() rcc.numbers['speed'][key]['min'] = tix.IntVar() rcc.numbers['attributes'] = {} for key in rcc.phys_attributes: rcc.numbers['attributes'][key] = {} rcc.numbers['attributes'][key]['max'] = tix.IntVar() rcc.numbers['attributes'][key]['min'] = tix.IntVar() rcc.numbers['attributes'][key]['sigma'] = tix.IntVar() for key in rcc.ment_attributes: rcc.numbers['attributes'][key] = {} rcc.numbers['attributes'][key]['max'] = tix.IntVar() rcc.numbers['attributes'][key]['min'] = tix.IntVar() rcc.numbers['attributes'][key]['sigma'] = tix.IntVar() rcc.numbers['variable'] = {} for key in rcc.variability: rcc.numbers['variable'][key] = {} rcc.numbers['variable'][key]['percent'] = tix.IntVar() r = 0 c = 0 sizeLabel = tix.Label(numbersSubFrame, text='Sizes:') sizeLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['size'] = {} creatureSize = {} size_variables = ['mean', 'sigma', 'min', 'vermin', 'tiny', 'trade'] for var in size_variables: r = r + 1 rcc.numbers['size'][var] = tix.IntVar() creatureSize[var] = tix.Control(numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['size'][var], autorepeat=False, integer=True) creatureSize[var].subwidget('decr').destroy() creatureSize[var].subwidget('incr').destroy() creatureSize[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( sizeLabel, msg= 'Size tokens [BODY_SIZE:x_1:y_1:a_1], [BODY_SIZE:x_2:y_2:a_2], and [BODY_SIZE:x_3:y_3:a_3] are calculated as follows:\n a_3 is calculated by selecting a random number from a gaussian distribution with a mean Mean and sigma Sigma\n a_1 is calculated by selecting a random number from a gaussian distribution with a mean a_3/100 and sigma Sigma/100\n a_2 = a_1 + a_3*75%, if this is > a_3 then a_2 and a_3 are switched\n x_1, y_1, y_2, and y_3 are all set to 0 for now\n x_2 is taken from [BABY:n] (see Ages for calculation) such that x_2 = n + 1\n x_3 is taken from [CHILD:n] (see Ages for calculation) such that x_3 = n + 2\nMin is the minimum size of any creature, if a_3 < Min then a_3 = Min\nVermin sets the maximum size needed for the #VERMIN flag, below this size #VERMIN is set to True\nTiny sets the maximum size needed for the #TINY flag, below this size #TINY is set to True\nTrade sets the minimum size needed for the #TRADE flag, above this size #TRADE is set to True\nMore information on the #VERMIN, #TINY, and #TRADE flags can be found in the readme' ) r = r + 1 ageLabel = tix.Label(numbersSubFrame, text='Ages:') ageLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['age'] = {} creatureAge = {} age_variables = ['max', 'min', 'baby', 'child', 'delta'] for var in age_variables: r = r + 1 rcc.numbers['age'][var] = tix.IntVar() creatureAge[var] = tix.Control(numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['age'][var], autorepeat=False, integer=True) creatureAge[var].subwidget('decr').destroy() creatureAge[var].subwidget('incr').destroy() creatureAge[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( ageLabel, msg= 'Ages tokens [MAX_AGE:a:b], [BABY:c], [CHILD:d] are calculated as follows:\n a is chosen between Min and Max\n b is chosen between Max and Max + Delta\n c is chosen between Baby - Delta and Baby + Delta\n d is chosen between Child - Delta and Child + Delta\nall choices are selected randomly from a triangular distribution\nif c > d then c is set to 0 and d is set to c\nif either c or d is 0 then that tag will not be added to the creature' ) r = 0 c = 1 popLabel = tix.Label(numbersSubFrame, text='Pop Numbers:') popLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['population'] = {} creaturePopulation = {} pop_variables = ['max', 'min'] for var in pop_variables: r = r + 1 rcc.numbers['population'][var] = tix.IntVar() creaturePopulation[var] = tix.Control( numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['population'][var], autorepeat=False, integer=True) creaturePopulation[var].subwidget('decr').destroy() creaturePopulation[var].subwidget('incr').destroy() creaturePopulation[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( popLabel, msg= 'Population token [POPULATION_NUMBER:x:y] is calculated as follows:\n x is chosen between 1 and Min\n y is chosen between Min and Max\nchoices are selected randomly from a triangular distribution\nFor Vermin and Tiny creatures x = 250 and y = 500' ) r = r + 1 clusLabel = tix.Label(numbersSubFrame, text='Cluster Numbers: ') clusLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['cluster'] = {} creatureCluster = {} clus_variables = ['max', 'min'] for var in clus_variables: r = r + 1 rcc.numbers['cluster'][var] = tix.IntVar() creatureCluster[var] = tix.Control( numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['cluster'][var], autorepeat=False, integer=True) creatureCluster[var].subwidget('decr').destroy() creatureCluster[var].subwidget('incr').destroy() creatureCluster[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( clusLabel, msg= 'Cluster token [CLUSTER_NUMBER:x:y] is calculated as follows:\n x is chosen between 1 and Min\n y is chosen between Min and Max\nchoices are selected randomly from a triangular distribution\nFor Vermin and Tiny creatures the cluster token is not used' ) r = r + 1 intLabel = tix.Label(numbersSubFrame, text='Interactions:') intLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['interaction'] = {} creatureInteraction = {} clus_variables = ['max', 'chance'] for var in clus_variables: r = r + 1 rcc.numbers['interaction'][var] = tix.IntVar() creatureInteraction[var] = tix.Control( numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['interaction'][var], autorepeat=False, integer=True) creatureInteraction[var].subwidget('decr').destroy() creatureInteraction[var].subwidget('incr').destroy() creatureInteraction[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( intLabel, msg= 'Max is the maximum number of interactions and one creature can have\nChance is the percent chance that each interaction slot is filled\nFor example, if Max is 3 and Chance is 50 then slot 1 will have a 50% chance of being filled, slot 2 will have a 50% chance of being filled, and slot 3 will have a 50% chance of being filled\nThis, of course, is dependent on their being 3 interactions that the creature meets the criteria for' ) r = r + 1 casteLabel = tix.Label(numbersSubFrame, text='Castes:') casteLabel.grid(row=r, column=c, stick=tix.W) rcc.numbers['caste'] = {} creatureCaste = {} clus_variables = ['male', 'female', 'neutral'] for var in clus_variables: r = r + 1 rcc.numbers['caste'][var] = tix.IntVar() creatureCaste[var] = tix.Control( numbersSubFrame, label=var.capitalize(), min=0, variable=rcc.numbers['caste'][var], autorepeat=False, integer=True) creatureCaste[var].subwidget('decr').destroy() creatureCaste[var].subwidget('incr').destroy() creatureCaste[var].grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( casteLabel, msg= 'The maximum number of castes each creature can have which meets specific criteria\nMale sets the maximum number of castes with the #MALE LINK\nFemale sets the maximum number of castes with the #FEMALE LINK\nNeutral sets the maximum number of castes without the #MALE or #FEMALE LINK\nFor more information on LINKs and the #MALE and #FEMALE flags see the readme' ) r += 1 subLabel = Label(numbersSubFrame, text='Subtypes:') subLabel.grid(row=r, column=c, stick=tix.W) r += 1 rcc.numbers['subtypes'] = tix.IntVar() creatureSubtypes = tix.Control(numbersSubFrame, label='Max', min=0, value=0, variable=rcc.numbers['subtypes'], autorepeat=False, integer=True) creatureSubtypes.subwidget('decr').destroy() creatureSubtypes.subwidget('incr').destroy() creatureSubtypes.grid(row=r, column=c, stick=tix.E, padx=10) numbersBalloon.bind_widget( subLabel, msg= 'Number of subtypes one creature can be, their total number of subtypes will be chosen between 0 and Max from a flat distribution' ) r = 0 c = 2 percLabel = Label(numbersSubFrame, text='Percents:') percLabel.grid(row=r, column=c, stick=tix.W) creaturePercentage = {} rcc.numbers['percents'] = {} temp = list(rcc.tokens.keys()) temp.sort() for key in temp: r += 1 rcc.numbers['percents'][key] = tix.IntVar() creaturePercentage[key] = tix.Control( numbersSubFrame, label=' ' + key, min=0, value=0, variable=rcc.numbers['percents'][key], autorepeat=False, integer=True) creaturePercentage[key].subwidget('decr').destroy() creaturePercentage[key].subwidget('incr').destroy() creaturePercentage[key].grid(row=r, column=2, stick=tix.E, padx=10) numbersBalloon.bind_widget( percLabel, msg= 'Percentage chance given token will be true\nIf you wish to generate a set of creatures that all share a commonality you would set the percent to 100' ) numbersSubFrame.grid(row=1, column=1)
def __init__(self,master): self.master=master b=tix.Balloon(self.master) self.tabcon=ttk.Notebook(self.master) self.pw=Frame(self.tabcon) self.tabcon.add(self.pw,text="Actions") self.pl=Frame(self.tabcon) self.tabcon.add(self.pl,text="Time") self.nb=Frame(self.tabcon) self.tabcon.add(self.nb,text="Loop") self.ia=Frame(self.tabcon) self.tabcon.add(self.ia,text="Objects") self.fg=Frame(self.tabcon) self.tabcon.add(self.fg,text="functions") self.df=Frame(self.tabcon) self.tabcon.add(self.df,text="key links") self.yu=Frame(self.tabcon) self.tabcon.add(self.yu,text="Screen") self.tabcon.grid(row=0,column=0,sticky="n") self.canvas = turtle.ScrolledCanvas(master = self.master) self.canvas.grid(row=0,column=1) self.screen=turtle.TurtleScreen(self.canvas) self.draw = turtle.RawTurtle(self.screen) self.screen.listen() self.draw.pu() self.objects={"Object1":self.draw} self.screen.onclick(self.listen) self.draw.ondrag(self.dragging) Button(self.pw,text="move upwards",command=self.up).grid() Button(self.pw,text="move downwards",command=self.down).grid() Button(self.pw,text="move right",command=self.right).grid() Button(self.pw,text="move left",command=self.left).grid() Button(self.pw,text="move forward",command=self.fwd).grid(row=4,column=0) Button(self.pw,text="move backward",command=self.bwd).grid(row=5,column=0) self.deg=Entry(self.pw) self.deg.grid(row=6,column=1) Button(self.pw,text="Rotate left",command=self.rotlt).grid(row=6,column=0) self.deg1=Entry(self.pw) self.deg1.grid(row=7,column=1) Button(self.pw,text="Rotate right",command=self.rotrt).grid(row=7,column=0) Button(self.pw,text="Show object",command=self.show).grid(row=8,column=0) Button(self.pw,text="Hide object",command=self.hide).grid(row=9,column=0) Button(self.pw,text="stamp",command=self.stamp).grid(row=10,column=0) Button(self.pw,text="clear previous stamp",command=self.clprestmp).grid(row=11) Button(self.pw,text="clear all stamps",command=self.clallstmp).grid(row=12) self.gotopos=Entry(self.pw) self.gotopos.grid(row=13,column=1) Button(self.pw,text="goto position",command=self.goto).grid(row=13,column=0) self.circpar=Entry(self.pw) self.circpar.grid(row=14,column=1) Button(self.pw,text="circle",command=self.circ).grid(row=14,column=0) b.bind_widget(self.circpar, msg="""Draw a circle with given radius. The center is radius units left of the turtle; extent – an angle – determines which part of the circle is drawn. If extent is not given, draw the entire circle. If extent is not a full circle, one endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if radius is positive, otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of extent. As the circle is approximated by an inscribed regular polygon, steps determines the number of steps to use. If not given, it will be calculated automatically. May be used to draw regular polygons. Enter the three parameters one after the other separated by commas. radius is compulsory.""") Button(self.pw,text="pen down",command=self.pendown).grid() Button(self.pw,text="pen up",command=self.penup).grid() Button(self.pw,text="Choose pen colour",command=lambda:self.colourchoose("pencolour")).grid() self.wo=Entry(self.pl) self.wo.grid(row=0,column=1) Button(self.pl,text="Wait for",command=self.wa).grid(row=0,column=0) self.delay=Entry(self.pl) self.delay.grid(row=1,column=1) Button(self.pl,text="set animation delay",command=self.dela).grid(row=1,column=0) self.speed=Entry(self.pl) self.speed.grid(row=2,column=1) Button(self.pl,text="set object speed",command=self.spee).grid(row=2,column=0) b.bind_widget(self.speed,msg="enter integer from 0 to 10. 0 means no animation.") self.lo=Entry(self.nb) self.lo.grid(row=0,column=1) Label(self.nb,text="Loop length").grid(row=0,column=0) Button(self.nb,text="Start loop",command=self.lop).grid(row=1,column=0) Button(self.nb,text="End loop",command=self.loz).grid(row=2,column=0) Button(self.ia,text="Object"+str(self.index),command=lambda:self.chobj("Object1")).grid(row=0,column=0) self.chs=Button(self.ia,text="Change shape of current object",command=lambda:self.chsh()) self.chs.grid(row=1,column=0) self.addt=Button(self.ia,text="Add object",command=lambda:self.addobj()) self.addt.grid(row=self.jj+1,column=0) self.curob=Label(self.ia,text="current object is Object1") self.curob.grid(row=self.jj+2) self.stf=Button(self.fg,text="Start Creating Function",command=lambda:self.stafunc()) self.stf.grid(row=self.jj1) self.stf1=Button(self.fg,text="Stop Creating Function",command=lambda:self.stofunc()) self.stf1.grid(row=self.jj1+1) func_name="" func="" self.keymenu=Menubutton(self.df,text="keys",relief=RAISED) self.keymenu.grid(row=self.fgh) self.keymenu.menu = Menu(self.keymenu,tearoff=0) self.keymenu["menu"]= self.keymenu.menu keys=['space','enter','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','Up','Down','Left','Right','1','2','3','4','5','6','7','8','9','0','Shift'] for j in keys: self.keymenu.menu.add_command(label=j,command=lambda j=j:self.key(j)) self.fulk=Entry(self.df) self.fulk.grid(row=self.fgh,column=1) self.keylink=Button(self.df,text="add keylink",command=lambda:self.addkeylink()) self.keylink.grid(row=self.fgh,column=2) Button(self.yu,text="Stop animating",command=self.stoani).grid() Button(self.yu,text="Start animating",command=self.staani).grid() Button(self.yu,text="choose bgpic",command=self.bgpic).grid() Button(self.yu,text="choose bgcolour",command=lambda:self.colourchoose("bgcolour")).grid() self.menubar=Menu(self.master) self.file = Menu(self.menubar, tearoff=0) self.file.add_command(label="New",command=lambda:self.new()) self.file.add_command(label="Open",command=lambda:self.ope()) self.file.add_command(label="Save",command=lambda:self.save()) self.file.add_command(label="Exit", command=self.master.quit) self.menubar.add_cascade(label="File", menu=self.file) self.edit = Menu(self.menubar, tearoff=0) self.edit.add_command(label="Undo",command=lambda:self.undo()) self.menubar.add_cascade(label="Edit", menu=self.edit) self.helpa = Menu(self.menubar, tearoff=0) self.helpa.add_command(label="About") self.menubar.add_cascade(label="Help", menu=self.helpa) self.run=Menu(self.menubar,tearoff=0) self.run.add_command(label="Run",command=lambda:self.starun()) self.menubar.add_cascade(label="Run",menu=self.run) self.master.config(menu=self.menubar)
#bulle_RomPath.bind_widget(Bouton_RomPath, msg='click me 1!') Bouton_InpPath = tix.Button(fenetre,text="Choisir un inp",font='Monospace 16 bold',borderwidth=3,bg='light gray',activeforeground='lime green',command=InpFile) Bouton_InpPath.pack() Bouton_InpPath.place(x=90, y=170) Bouton_InpPath.configure(state='disabled') #Bouton_InpPath.configure(state='normal') #bulle_InpPath = tix.Balloon(fenetre) #bulle_InpPath.bind_widget(Bouton_InpPath, msg='click me 2!') Bouton_playbackAVI = tix.Button(fenetre,text="Rejouer vers AVI",font='Monospace 16 bold',borderwidth=3,bg='light gray',activeforeground='lime green',command=playbackAVI) Bouton_playbackAVI.pack() Bouton_playbackAVI.place(x=90, y=320) Bouton_playbackAVI.configure(state='disabled') #Bouton_playbackAVI.configure(state='normal') bulle_playbackAVI = tix.Balloon(fenetre) bulle_playbackAVI.bind_widget(Bouton_playbackAVI, msg='''Nécessite environ 1 Gio/minute d'espace disque !!!''') bulle_playbackAVI.config(bg='lime green') Bouton_playbackMNG = tix.Button(fenetre,text="Rejouer vers MNG",font='Monospace 16 bold',borderwidth=3,bg='light gray',activeforeground='lime green',command=playbackMNG) Bouton_playbackMNG.pack() Bouton_playbackMNG.place(x=350, y=320) Bouton_playbackMNG.configure(state='disabled') #Bouton_playbackMNG.configure(state='normal') bulle_playbackMNG = tix.Balloon(fenetre) bulle_playbackMNG.bind_widget(Bouton_playbackMNG, msg='''Met environs 5 fois plus de temps, mais ne nécessite que 312 Mio/minute d'espace disque !!!''') bulle_playbackMNG.config(bg='lime green') Bouton_EncodageX264 = tix.Button(fenetre,text="Encodage Vidéo",font='Monospace 16 bold',borderwidth=3,bg='light gray',activeforeground='lime green',command=Encodagex264) Bouton_EncodageX264.pack() Bouton_EncodageX264.place(x=90, y=370)
def __init__(self, root): self.errors = None self.source_files = None self.main_frame = ttk.Frame(root) self.main_frame.grid() intro_txt = 'This little app merges data from multiple MS Excel files into one master spreadsheet.' self.introlbl = ttk.Label(self.main_frame, justify="left", anchor="n", padding=(10, 2, 10, 6), text=intro_txt) self.introlbl.grid(row=0) self.top_frame = ttk.Frame(self.main_frame) self.top_frame.grid(row=1) self.controls_frame = ttk.Frame(self.top_frame) self.controls_frame.grid(row=1, column=0, sticky='e') self.dir_path = tk.StringVar() self.folder_lbl = ttk.Label(self.controls_frame, justify="left", anchor="w", text='Source files path:') self.folder_lbl.grid(row=1, column=0, sticky='e') self.path_entry = ttk.Entry(self.controls_frame, textvariable=self.dir_path, width=50) self.path_entry.grid(row=1, column=1, sticky='we', padx=(5, 5)) self.browse_btn = ttk.Button(self.controls_frame, command=self.browse_dir, text='Browse') self.browse_btn.grid(row=1, column=2) self.masterfile_path = tk.StringVar() self.folder_lbl = ttk.Label(self.controls_frame, justify="left", anchor="w", text='Master spreadsheet location:') self.folder_lbl.grid(row=2, column=0, sticky='e') self.path_entry = ttk.Entry(self.controls_frame, textvariable=self.masterfile_path, width=50) self.path_entry.grid(row=2, column=1, sticky='we', padx=(5, 5)) self.browse_btn = ttk.Button(self.controls_frame, command=self.browse_file, text='Browse') self.browse_btn.grid(row=2, column=2) self.maxrows_lbl = ttk.Label(self.controls_frame, justify="left", anchor="e", text='Max row number:') self.maxrows_spiner = tk.Spinbox(self.controls_frame, from_=1, to=1000, increment=10, width=5) self.maxrows_lbl.grid(row=3, column=0, sticky='e') self.maxrows_spiner.grid(row=3, column=1, sticky='w', padx=(5, 5)) self.maxcols_lbl = ttk.Label(self.controls_frame, justify="left", anchor="e", text='Max column number:') self.maxcols_spiner = tk.Spinbox(self.controls_frame, from_=1, to=1000, increment=10, width=5) self.maxcols_lbl.grid(row=4, column=0, sticky='e') self.maxcols_spiner.grid(row=4, column=1, sticky='w', padx=(5, 5)) self.navi_frame = ttk.Frame(self.top_frame) self.navi_frame.grid(row=2, padx=(10, 10), pady=(20, 10), sticky='s') self.calc_btn = ttk.Button(self.navi_frame, text='Merge data', command=self.gui_calc) self.calc_btn.grid(row=1, column=1, sticky='nsew') self.close_btn = ttk.Button(self.navi_frame, command=lambda: root.destroy(), text='Close') self.close_btn.grid(row=1, column=3, sticky='nsew') self.help_btn = ttk.Button(self.navi_frame, text='Help', command=self.show_help) self.help_btn.grid(row=1, column=2, sticky='nsew') self.botom_frame = ttk.Frame(self.main_frame) self.botom_frame.grid(row=2) status_txt = "Prepare your master file first (read Help for more info)" self.status_lbl = PixelLabel(self.botom_frame, 1, borderwidth=1, relief='sunken', background='#D9D9D9', text=status_txt) self.status_lbl.grid(row=3, sticky='w', column=0) # self.status_lbl.grid(row=3,sticky='nsew',columnspan=1,wraplenght='4i') self.brag = ttk.Label(self.botom_frame, text="about", borderwidth=1, relief='sunken', background='#D9D9D9', width=6) self.brag.grid(row=3, column=1, sticky='e') self.status_lbl.resize(root, self.brag) # root.tk.call("load", "", "Tix") self.baloon = tk.Balloon() self.baloon.bind_widget( self.brag, balloonmsg='ver1.0 created in Warsaw by [email protected]')
raise except Exception as e: print(e) raise window = tix.Tk() window.title('GANILLA UI - TEST') window.geometry("720x600") window.resizable(False, False) window.configure(bg="white") progress_var = DoubleVar() progressbar = ttk.Progressbar(variable=progress_var, length=230) tip = tix.Balloon(window) tip.label.configure(bd=0) frameEpochLabel = Frame() frameEpochLabel.configure(bg="white") frameEpoch = Frame() frameEpoch.configure(bg="white") frameModel = Frame() frameModel.configure(bg="white") frameInput = Frame() frameInput.configure(bg="white") frameConvert = Frame() frameConvert.configure(bg="white") frameLabels = Frame(window) frameLabels.configure(bg="white")
def __init__(self, root, server_filter): self.reports = [] self.server_temp_counts = [] self.path = '' self.server_cols_filter = server_filter self.dir_frame = ttk.Frame(root) self.dir_frame.grid() intro_txt = 'This little app helps to summarise multiple XML result files for IT Equipment(servers) exported from 6Sigma CFD simulation software.' self.introlbl = ttk.Label(self.dir_frame, justify="left", anchor="n", padding=(10, 2, 10, 6), text=intro_txt) self.introlbl.grid(row=0) self.top_frame = ttk.Frame(self.dir_frame) self.top_frame.grid(row=1) self.controls_frame = ttk.Frame(self.top_frame) self.controls_frame.grid(row=1, column=0, sticky='e') self.dir_path = tk.StringVar() self.folder_lbl = ttk.Label(self.controls_frame, justify="left", anchor="w", text='Result xml files location:') self.folder_lbl.grid(row=1, column=0, sticky='e') self.path_entry = ttk.Entry(self.controls_frame, textvariable=self.dir_path, width=50) self.path_entry.grid(row=1, column=1, sticky='we', padx=(5, 5)) self.browse_btn = ttk.Button(self.controls_frame, command=self.browse_dir, text='Browse') self.browse_btn.grid(row=1, column=2) self.temp_lbl = ttk.Label(self.controls_frame, justify="left", anchor="e", text='Max. server inlet temp. [degC]:') self.temp_spiner = tk.Spinbox(self.controls_frame, from_=15, to=40, increment=0.5, width=5) for i in range(0, (27 - 15) * 2): self.temp_spiner.invoke('buttonup') self.temp_lbl.grid(row=2, column=0, sticky='e') self.temp_spiner.grid(row=2, column=1, sticky='w', padx=(5, 5)) self.navi_frame = ttk.Frame(self.top_frame) self.navi_frame.grid(row=1, column=1, padx=(10, 10), pady=(0, 10), sticky='w') self.calc_btn = ttk.Button(self.navi_frame, text='Calculate', command=self.gui_calc) self.calc_btn.grid(row=0, sticky='nsew') self.export_btn = ttk.Button(self.navi_frame, text='Export to CSV', command=self.gui_export_csv) self.export_btn.grid(row=1, sticky='nsew') self.export_btn = ttk.Button(self.navi_frame, text='Help', command=self.show_help) self.export_btn.grid(row=2, sticky='nsew') self.close_btn = ttk.Button(self.navi_frame, command=lambda: root.destroy(), text='Close') self.close_btn.grid(row=3, sticky='nsew') self.tree_headers() self.update_tree_views() self.botom_frame = ttk.Frame(self.dir_frame) self.botom_frame.grid(row=6) status_txt = "Browse for folder containing multiple XML files (only 6Sigma 'IT Equipment' PropertyTable export files will be filtered off for analysis), set max. temp SLA threshold. Then click 'Calculate'" self.status_lbl = PixelLabel(self.botom_frame, 1, borderwidth=1, relief='sunken', background='#D9D9D9', text=status_txt) self.status_lbl.grid(row=3, sticky='w', column=0) # self.status_lbl.grid(row=3,sticky='nsew',columnspan=1,wraplenght='4i') self.brag = ttk.Label(self.botom_frame, text="about", borderwidth=1, relief='sunken', background='#D9D9D9', width=6) self.brag.grid(row=3, column=1, sticky='e') self.status_lbl.resize(root, self.brag) # root.tk.call("load", "", "Tix") self.baloon = tk.Balloon() self.baloon.bind_widget( self.brag, balloonmsg='ver1.2 created in Warsaw by [email protected]')
def _createWidgets_(self): self.fsFrame = tk.Frame(self.mFrame) self.tk_setPalette(background = '#F2D7D5') ##F2D7D5 self.btQuit = tk.Button(self.mFrame) self.btQuit.config(text = 'Завершить', command = self.root.destroy) self.btQuit.pack(side =tk.BOTTOM) ##self.loadFrame = tk.LabelFrame(self.fsFrame) ##self.listBMsg = tk.Listbox(self.loadFrame, relief='flat') self.topElemsFrame = tk.Frame(self.fsFrame) self.btnLstFrame = tk.LabelFrame(self.topElemsFrame) self.smplUnqOptFrame = tk.Frame(self.topElemsFrame) self.smplUnqOptLabelF = tk.LabelFrame(self.smplUnqOptFrame) self._lbSmplUnqOptLabelF_ = self.getSubWgts(self.smplUnqOptLabelF, tk._dummyLabel) self._lbSmplUnqOptLabelF_.config(text = "Уник. сэмпл.") self._frSmplUnqOptLabelF_ = self.getSubWgts(self.smplUnqOptLabelF, tk._dummyFrame) self.cbIfCutUrl = tk.Checkbutton(self._frSmplUnqOptLabelF_, text = "Сократ. Url в назв. сэмпл.", variable = self._varIfCutUrlInSmpl_) self.smplThruNum = tk.LabelFrame(self._frSmplUnqOptLabelF_) self._lbSmplThruNum_ = self.getSubWgts(self.smplThruNum, tk._dummyLabel) self._lbSmplThruNum_.config(text = "Скозн. нумер.") self._frSmplThruNum_ = self.getSubWgts(self.smplThruNum, tk._dummyFrame) self.smplThruNumCntrl = tk.Radiobutton(self._frSmplThruNum_, text = "Контроллер", variable = self._varRbSmplThruNum_, value = "Controller") self.smplThruNumThGr = tk.Radiobutton(self._frSmplThruNum_, text = "ТредГрупп", variable = self._varRbSmplThruNum_, value = "ThreadGroup") self.smplThruNumTstPl = tk.Radiobutton(self._frSmplThruNum_, text = "ТестПлан", variable = self._varRbSmplThruNum_, value = "TestPlan") self.smplThruNumCntrl.pack(side = tk.TOP, anchor = tk.W) self.smplThruNumThGr.pack(side = tk.TOP, anchor = tk.W) self.smplThruNumTstPl.pack(side = tk.TOP, anchor = tk.W) self.cbIfNotRstrUnqInSmpl = tk.Checkbutton(self._frSmplUnqOptLabelF_, text = "Не восст. ориг. назв. сэмпл.", variable = self._varCbIfNotRstrUnqInSmpl_) self.cbIfCutUrl.pack(side = tk.TOP, anchor = tk.W) self.smplThruNum.pack(side = tk.TOP, anchor = tk.W) self.cbIfNotRstrUnqInSmpl.pack(side = tk.TOP, anchor = tk.W) self.smplUnqOptLabelF.pack(anchor = tk.E) self.smplUnqOptFrame.config(width = self.smplThruNum.winfo_reqwidth(), padx = 100) self.paramVolatilFrame = tk.Frame(self.topElemsFrame) self.update_idletasks() leftCornerWidth = self._frSmplUnqOptLabelF_.winfo_reqwidth() + int(self.smplUnqOptLabelF.cget("borderwidth")) * 2 leftCornerHeight = self.smplUnqOptLabelF.winfo_reqheight() + 2 self.paramVolatilFrame.config(width = leftCornerWidth + 202, height = leftCornerHeight) self.paramVolatilFrame.pack_propagate(0) self.paramVolatilLabel = tk.LabelFrame(self.paramVolatilFrame) self._lbParamVolatilLabel_ = self.getSubWgts(self.paramVolatilLabel, tk._dummyLabel) self._lbParamVolatilLabel_.config(text = "Статистика") self._frParamVolatilLabel_ = self.getSubWgts(self.paramVolatilLabel, tk._dummyFrame) self.frBtGetVolatilPrm = tk.Frame(self._frParamVolatilLabel_) self.btBtGetVolatilPrm = tk.Button(self.frBtGetVolatilPrm, text="Получ. стат. по парам.") self.rBtGetVolatilPrm = tk.Radiobutton(self.frBtGetVolatilPrm, text = 'Волатил. ', variable = self._volatilPrm_, value = True) self.rBtGetNonVolatilPrm = tk.Radiobutton(self.frBtGetVolatilPrm, text = 'Не волатил.', variable = self._volatilPrm_, value = False) self.btBtGetVolatilPrm.config(relief='groove') self.btBtGetVolatilPrm.config(command = self.prcdfGetVolatilPrms) self.frBtGetVolatilPrm.pack(side = tk.TOP, anchor = tk.W) self.btBtGetVolatilPrm.pack(side = tk.LEFT) self.rBtGetVolatilPrm.pack(side = tk.TOP, anchor = tk.W) self.rBtGetNonVolatilPrm.pack(side = tk.TOP, anchor = tk.W) self.paramVolatilLabel.pack(anchor = tk.W) ##self.msgsToAscFrame = tk.Listbox(self.loadFrame, relief='flat', selectmode='multiple') ##self.vScroll = tk.Scrollbar(self.loadFrame, orient=tk.VERTICAL) ##self.msgsToAscFrame.config( yscrollcommand=self.vScroll.set) self.consFrame = tk.LabelFrame(self.mFrame) #self.varsFrame = tk.LabelFrame(self.fsFrame) ##self.btnCollctnFrame = tk.LabelFrame(self.fsFrame) self.mCllctnFrame = tk.Frame(self.mFrame) self._lbBtnLstFrame_ = self.getSubWgts(self.btnLstFrame, tk._dummyLabel) self._lbBtnLstFrame_.config(text = 'Раб. с исх. Xml-дер.') self._frBtnLstFrame_ = self.getSubWgts(self.btnLstFrame, tk._dummyFrame) self.varsFrame = tk.Frame(self._frBtnLstFrame_, borderwidth=2, bg = 'blue') self.vrSPathFrame = tk.Label(self.varsFrame) self.vrFnameFrame = tk.Label(self.varsFrame) self.vrUnqFNmFrame = tk.Label(self.varsFrame) #self.vrPileCllctnFrame = tk.Label(self.varsFrame) self.vrRestreFNmFrame = tk.Label(self.varsFrame) self._btnLstFrame_ = tk.Frame(self._frBtnLstFrame_, borderwidth = 2) self.btCatchJMXFiles = tk.Button(self._btnLstFrame_, text="Собрать все \n.jmx файлы", fg="green") #self.btCatchJMXFiles.config(command = self.testFrame) self.btCatchJMXFiles.config(command = self.prcdCatchJMXFiles) self.btCatchJMXFiles.config(relief='raised') self.btCatchJMXFiles.pack(fill = 'x') #self.jmscdObj.setFName = 'toParce.jmx' self.btGetJMXMkTree = tk.Button(self._btnLstFrame_, text="Получить дерево из \n.jmx файла", fg="green") self.btGetJMXMkTree.config(command = self.prcdGetJMXMkTree) self.btGetJMXMkTree.config(relief='raised') self.btGetJMXMkTree.pack(fill = 'x') self.btTreeUnqNms = tk.Button(self._btnLstFrame_, text="Сген. колл. \nс уник. именами") self.btTreeUnqNms.config(command = self.prcdTreeUnqNms) self.btTreeUnqNms.config(relief='raised', state = tk.DISABLED) self.btTreeUnqNms.pack(fill = 'x') self.btRstrOrigNms = tk.Button(self._btnLstFrame_, text="Восст. ориг. имена\nдля получен. колл.") self.btRstrOrigNms.config(command = self.prcdRstrOrigNms) self.btRstrOrigNms.config(relief='raised') self.btRstrOrigNms.pack(fill = 'x') self.vrSPathLabel = tk.Label(self.vrSPathFrame) self.vrSPathValue = tk.Entry(self.vrSPathFrame, bg='white') self.vrSPathLabel.config(text='Каталог с (*.jmx) файл.:', justify = tk.LEFT) self.vrSPathValue.config(justify = tk.LEFT) self.vrSPathValue.insert(0, self.jmscdObj.setPATH) self.vrSPathLabel.pack(side = tk.LEFT) self.vrSPathValue.pack(side = tk.LEFT) self.vrSPathFrame.pack(side = tk.TOP) self.vrFnameLabel = tk.Label(self.vrFnameFrame) self.vrFnameValue = tk.Entry(self.vrFnameFrame, bg='white') self.vrFnameLabel.config(text='Файл(*.jmx) для парам.:', justify = tk.LEFT) self.vrFnameValue.config(justify = tk.LEFT) self.vrFnameValue.insert(0, self.jmscdObj.setFName) self.vrFnameLabel.pack(side = tk.LEFT) self.vrFnameValue.pack(side = tk.LEFT) self.vrFnameFrame.pack(side=tk.TOP) self.vrUnqFNmLabel = tk.Label(self.vrUnqFNmFrame) self.vrUnqFNmValue = tk.Entry(self.vrUnqFNmFrame, bg = 'white') self.vrUnqFNmLabel.config(text='Файл(*.jmx), униф. элм.:', justify = tk.LEFT) self.vrUnqFNmValue.config(justify = tk.LEFT) self.vrUnqFNmValue.insert(0, self.jmscdObj.outFileUniqueNames) self.vrUnqFNmLabel.pack(side = tk.LEFT) self.vrUnqFNmValue.pack(side = tk.LEFT) self.vrUnqFNmFrame.pack(side=tk.TOP) self.vrRestreFNmLabel = tk.Label(self.vrRestreFNmFrame) self.vrRestreFNmValue = tk.Entry(self.vrRestreFNmFrame, bg = 'white') self.vrRestreFNmLabel.config(text='Файл(*.jmx), восcт. элм.:', justify = tk.LEFT) self.vrRestreFNmValue.config(justify = tk.LEFT) self.vrRestreFNmValue.insert(0, self.jmscdObj.outFileRestrdOrig) self.vrRestreFNmLabel.pack(side = tk.LEFT) self.vrRestreFNmValue.pack(side = tk.LEFT) self.vrRestreFNmFrame.pack(side=tk.TOP) self._btnLstFrame_.pack(side = tk.TOP) self.varsFrame.pack(side=tk.TOP) ## self.frPileOptns = tk.LabelFrame(self.mCllctnFrame) self._lbFrPileOptns_ = self.getSubWgts(self.frPileOptns, tk._dummyLabel) self._lbFrPileOptns_.config(text = 'Получ. осн. колл.') self._frPileOptns_ = self.getSubWgts(self.frPileOptns, tk._dummyFrame) self.scrollPileMCllt = tk.Scrollbar(self._frPileOptns_, orient = tk.VERTICAL) self.scrollPileMCllt.pack(side = tk.RIGHT, fill = 'y') self.lsbxPileMCllct = tk.Listbox(self._frPileOptns_, height = 4, width = 34, yscrollcommand = self.scrollPileMCllt.set) for itm in range(4): self.lsbxPileMCllct.insert(tk.END, '--') self.btPileMCllct = tk.Button(self._frPileOptns_, text="Аккумул. раб. коллекц.") self.btPileMCllct.config(command = self.prcdPileMCllct, relief='groove') self.lsbxPileMCllct.pack(side = tk.TOP) self.btPileMCllct.pack(side = tk.TOP) self.frPileOptns.pack(side = tk.LEFT) self.scrollPileMCllt.config(command = self.lsbxPileMCllct.yview) self.frOutRslts = tk.LabelFrame(self.mCllctnFrame) self._lbFrOutRslts_ = self.getSubWgts(self.frOutRslts, tk._dummyLabel) self._lbFrOutRslts_.config(text = 'Текущ. знач.') self._frOutRslts_ = self.getSubWgts(self.frOutRslts, tk._dummyFrame) self.entStrVar = tk.StringVar(self._frOutRslts_) #self.entStrVar.set(self.jmscdObj.entityNames[2]) # default value self.lstWrkEnts = tk.OptionMenu(self._frOutRslts_, variable = self.entStrVar) for ent in self.jmscdObj.entityNames: self.lstWrkEnts.add_command(ent) self.entStrVar.set(self.jmscdObj.entityNames[2]) #self.lstWrkEnts = tk.Listbox(self.mCllctnFrame) ##Опция выбора сущности на данный момент выключена ####self.lstWrkEnts.pack(side = tk.TOP) self.tstOutText = tk.Text(self._frOutRslts_, state = tk.DISABLED, bg='#FFEFD5')#, width=64) self.tstOutText.pack(side = tk.TOP) self.txtWdgtDelete(False) self.txtWdgtInsert(self._initText_) # self.frWrInfExtCntrlElm = tk.Frame(self._frOutRslts_) self.btWriteChngsToF = tk.Button(self.frWrInfExtCntrlElm, text='Запис. изм.\nв файл') self.btWriteChngsToF.config(command = self.prcdWrtXmlTree) self.btUpdateXMLTree = tk.Button(self.frWrInfExtCntrlElm, text='Обнов. \nxml-дерево') self.btUpdateXMLTree.config(command = self.prcdUpdtXMLTree, state = tk.DISABLED) self.btUpdateXMLTree.pack(side = tk.LEFT) self.btWriteChngsToF.pack(side = tk.LEFT) self.frWrInfExtCntrlElm.pack(side = tk.BOTTOM) # self.frOutRslts.pack(side = tk.LEFT) ### self.frGetCollctnData = tk.Frame(self.mCllctnFrame) # self.frGetListKeys = tk.LabelFrame(self.frGetCollctnData) self._frGetListKeys_ = self.getSubWgts(self.frGetListKeys, tk._dummyFrame) self.frBtGetLstKeys = tk.Frame(self._frGetListKeys_) self.btGetListKeys = tk.Button(self.frBtGetLstKeys, text="Список получ. ключей:") self.varRBtLstKeys = tk.IntVar() self.varRBtLstKeys.set(1) self.rBtLstKeysPrms = tk.Radiobutton(self.frBtGetLstKeys, text = 'Парам. ', variable = self.varRBtLstKeys, value = 1) self.rBtLstKeysLnks = tk.Radiobutton(self.frBtGetLstKeys, text = 'Ссылки', variable = self.varRBtLstKeys, value = 2) self.btGetListKeys.config(relief='groove') self.btGetListKeys.config(command = self.prcdfGetListKeys) self._lbGetListKeys_ = self.getSubWgts(self.frGetListKeys, tk._dummyLabel) self._lbGetListKeys_.config(text = 'Раб. с осн. коллекц.') self.frBtGetLstKeys.pack(side = tk.TOP, anchor = tk.W) self.btGetListKeys.pack(side = tk.LEFT) self.rBtLstKeysPrms.pack(side = tk.TOP, anchor = tk.E) self.rBtLstKeysLnks.pack(side = tk.TOP, anchor = tk.E) self.frGetListKeys.pack(side = tk.TOP, fill = 'x') # self.frGetDictData = tk.Frame(self._frGetListKeys_) self.frGetDictData.config(borderwidth = 2, bg = 'green') ## self.frGetDataDictItem = tk.Frame(self.frGetDictData) self.vlGetDataDictItem = tk.Entry(self.frGetDataDictItem, bg='white') self.vlGetDataDictItem.insert(0, '<знач.ключа>') self.btGetDataDictItem = tk.Button(self.frGetDataDictItem, text="Все знач.\nпо задан. ключу:") self.btGetDataDictItem.config(command = self.prcdGetDataDictItem) self.btGetDataDictItem.config(relief='groove') self.btGetDataDictItem.pack(side= tk.LEFT) self.vlGetDataDictItem.pack(side = tk.RIGHT, fill = 'y') self.frGetDataDictItem.pack(side = tk.TOP) ## self.frGetScrLstByNm = tk.Frame(self.frGetDictData) self.btGetScrLstByNm = tk.Button(self.frGetScrLstByNm, text="Все контрлр.\nпо задан. ключу:") self.btGetScrLstByNm.config(command = self.prcdGetScrLstByNm) self.btGetScrLstByNm.config(relief='groove') self.vlGetScrLstByNm = tk.Entry(self.frGetScrLstByNm, bg='white') self.vlGetScrLstByNm.insert(0, '<знач.ключа>') self.chkBtVar = tk.BooleanVar(self.frGetScrLstByNm) self.chkBtVar.set(False) self.chkGetScrLstByNm = tk.Checkbutton(self.frGetScrLstByNm, text='Вывод сэмплр.', variable=self.chkBtVar) self.btGetScrLstByNm.pack(side= tk.LEFT) self.vlGetScrLstByNm.pack(side = tk.TOP) self.chkGetScrLstByNm.pack(side = tk.LEFT) self.frGetScrLstByNm.pack(side = tk.TOP) ## self.frGetScrFncByKeyVal = tk.Frame(self.frGetDictData) self.btGetScrFncByKeyVal = tk.Button(self.frGetScrFncByKeyVal, text="Все контрлр.\nпо паре кл.-зн.:") self.btGetScrFncByKeyVal.config(command = self.prcdGetScrFncByKeyVal) self.btGetScrFncByKeyVal.config(relief='groove') self.vlGetScrFncByKeyVal = tk.Entry(self.frGetScrFncByKeyVal, bg='white') self.vlGetScrFncByKeyVal.insert(0, '<знач.ключа>') self.vrGetScrFncByKeyVal = tk.Entry(self.frGetScrFncByKeyVal, bg='white') self.vrGetScrFncByKeyVal.insert(0, '<знач.парам.>') self.chkKeyVlVar = tk.BooleanVar(self.frGetScrFncByKeyVal) self.chkKeyVlVar.set(False) self.chkGetScrFncByKeyVal = tk.Checkbutton(self.frGetScrFncByKeyVal, text='Вывод сэмплр.', variable=self.chkKeyVlVar) self.btGetScrFncByKeyVal.pack(side= tk.LEFT, fill='y') self.vlGetScrFncByKeyVal.pack(side = tk.TOP) self.vrGetScrFncByKeyVal.pack(side = tk.TOP) self.chkGetScrFncByKeyVal.pack(side = tk.LEFT) self.frGetScrFncByKeyVal.pack(side = tk.TOP, fill='x') ## self.frGetValByKSF = tk.Frame(self.frGetDictData) self.frGetValByKSF.config(borderwidth = 1, bg = 'red') self.blnMsg = tk.Balloon(self.frGetValByKSF, initwait = 350, bg='yellow') self.blnMsgText = 'Внимание!\nНазвания контроллеров и сэмплеров (возможно) были изменены,\nследует сверять в jmeter по файлу "(*.jmx) униф. эл"' self.blnMsg.bind_widget(self.frGetValByKSF, msg = self.blnMsgText) self.btGetValByKSF = tk.Button(self.frGetValByKSF, text="Значен. для\n кл.-кнтр.-смпл.:") self.btGetValByKSF.config(command = self.prcdGetValByKSF) self.btGetValByKSF.config(relief='groove') self.vlGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white') self.vlGetValByKSF.insert(0, '<знач.ключа>') self.ctGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white') self.ctGetValByKSF.insert(0, '<назв. контрлр.>') self.smGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white') self.smGetValByKSF.insert(0, '<назв. сэмплр.>') self.btGetValByKSF.pack(side= tk.LEFT, fill='y') self.vlGetValByKSF.pack(side = tk.TOP) self.ctGetValByKSF.pack(side = tk.TOP) self.smGetValByKSF.pack(side = tk.TOP) self.frGetValByKSF.pack(side = tk.TOP, fill='x') ## self.frSetValsToSlctn = tk.Frame(self._frGetListKeys_, pady = 2) self.btSetValsToSlctn = tk.Button(self.frSetValsToSlctn, text = 'Установ.\n для дан.\n элемен.\n словар.') self.btSetValsToSlctn.config(command = self.prcdSetValsToSlctn, state = tk.DISABLED, relief = "groove") self.lblSetValsToSlctn = tk.Label(self.frSetValsToSlctn, text = ' <==> ') self.entSetValsToSlctn = tk.Entry(self.frSetValsToSlctn, bg='white') self.entSetValsToSlctn.insert(0, '*новое знач.*') self.btSetValsToSlctn.pack(side = tk.LEFT, anchor=tk.W) self.lblSetValsToSlctn.pack(side = tk.LEFT) self.entSetValsToSlctn.pack(side = tk.RIGHT, anchor=tk.E) ### self.frGetDictData.pack(side = tk.TOP) self.frSetValsToSlctn.pack(side = tk.TOP, anchor = tk.W) # self.frGetCollctnData.pack(side = tk.LEFT) #for lstEntr in self.jmscdObj.entityNames: # self.lstWrkEnts.insert(tk.END, lstEntr) self.fsFrame.pack(side="top", fill='x') self.mCllctnFrame.pack(side=tk.LEFT, fill='x') ##self.loadFrame.pack(side="top", fill='x') self.smplUnqOptFrame.pack(side = tk.RIGHT, anchor = tk.E) self.btnLstFrame.pack(side = tk.RIGHT) self.paramVolatilFrame.pack(side = tk.RIGHT) self.topElemsFrame.pack(side="top", fill='y')
def widgets_frame1(self): self.canvas_bt = Canvas(self.frame_1, bd=0, bg='#1e3743', highlightbackground='gray', highlightthickness=5) self.canvas_bt.place(relx=0.19, rely=0.08, relwidth=0.22, relheight=0.19) ### Criação do botao limpar self.bt_limpar = Button(self.frame_1, text="Limpar", bd=2, bg='#107db2', fg='white', activebackground='#108ecb', activeforeground="white", font=('verdana', 8, 'bold'), command=self.limpa_cliente) self.bt_limpar.place(relx=0.2, rely=0.1, relwidth=0.1, relheight=0.15) ### Criação do botao buscar self.bt_buscar = Button(self.frame_1, text="Buscar", bd=2, bg='#107db2', fg='white', font=('verdana', 8, 'bold'), command=self.busca_cliente) self.bt_buscar.place(relx=0.3, rely=0.1, relwidth=0.1, relheight=0.15) self.balao_buscar = tix.Balloon(self.frame_1) self.balao_buscar.bind_widget( self.bt_buscar, balloonmsg="Digite no campo Nome o cliente que deseja pesquisar") ### Criação do botao novo ## imgNovo self.btnovo = PhotoImage(data=base64.b64decode(self.btnovo_base64)) self.btnovo = self.btnovo.subsample(2, 2) self.bt_novo = Button(self.frame_1, bd=0, image=self.btnovo, command=self.add_cliente) self.bt_novo.place(relx=0.55, rely=0.1, width=60, height=30) ### Criação do botao alterar self.btalterar = PhotoImage( data=base64.b64decode(self.btalterar_base64)) self.btalterar = self.btalterar.subsample(2, 2) self.bt_alterar = Button(self.frame_1, image=self.btalterar, bd=0, command=self.altera_cliente) self.bt_alterar.place(relx=0.67, rely=0.1, width=60, height=30) ### Criação do botao apagar self.bt_apagar = Button(self.frame_1, text="Apagar", bd=2, bg='#107db2', fg='white', font=('verdana', 8, 'bold'), command=self.deleta_cliente) self.bt_apagar.place(relx=0.8, rely=0.1, relwidth=0.1, relheight=0.15) ## Criação da label e entrada do codigo self.lb_codigo = Label(self.frame_1, text="Código", bg='#dfe3ee', fg='#107db2') self.lb_codigo.place(relx=0.05, rely=0.05) self.codigo_entry = Entry(self.frame_1) self.codigo_entry.place(relx=0.05, rely=0.15, relwidth=0.08) ## Criação da label e entrada do nome self.lb_nome = Label(self.frame_1, text="Nome", bg='#dfe3ee', fg='#107db2') self.lb_nome.place(relx=0.05, rely=0.35) self.nome_entry = Entry(self.frame_1) self.nome_entry.place(relx=0.05, rely=0.45, relwidth=0.8) ## Criação da label e entrada do telefone self.lb_nome = Label(self.frame_1, text="Telefone", bg='#dfe3ee', fg='#107db2') self.lb_nome.place(relx=0.05, rely=0.6) self.fone_entry = Entry(self.frame_1) self.fone_entry.place(relx=0.05, rely=0.7, relwidth=0.4) ## Criação da label e entrada da cidade self.lb_nome = Label(self.frame_1, text="Cidade", bg='#dfe3ee', fg='#107db2') self.lb_nome.place(relx=0.5, rely=0.6) self.cidade_entry = Entry(self.frame_1) self.cidade_entry.place(relx=0.5, rely=0.7, relwidth=0.4)
lb10.grid(row=0, column=12) #增加 Combobox book = tk.StringVar() g.book_s=book bookChosen = ttk.Combobox(frame, width=10, textvariable=book) bookChosen['values'] = ('HPCPX','KDJ', 'MACD','RSI','OBV','BOLL',\ '自定义','HPYYX') bookChosen.grid(row=0, column=13) bookChosen.current(0) #设置初始显示值,值为元组['values']的下标 bookChosen.config(state='readonly') #设为只读模式 frame.grid(row=0, column=6, padx=1, pady=1, sticky=tk.E) g.vbook=book # 建立 tixballoon b = tix.Balloon(root, statusbar=status.l[2]) b.bind_widget(toolsbar.t[0], balloonmsg='工作台', statusmsg='按下这个按钮,切换到工作台画面。') b.bind_widget(toolsbar.t[1], balloonmsg='报价分析', statusmsg='按下这个按钮,切换到报价分析画面。') b.bind_widget(toolsbar.t[2], balloonmsg='技术分析', statusmsg='按下这个按钮,切换到技术分析画面。') b.bind_widget(toolsbar.t[3], balloonmsg='装载插件', statusmsg='按下这个按钮,装入用户插件程序。') b.bind_widget(toolsbar.t[4], balloonmsg='执行策略', statusmsg='按下这个按钮,执行代码编辑器中。') b.bind_widget(status.l[0], balloonmsg='状态栏')
def widgets_frame1(self): text_label = ['Clean', 'Seach', 'New', 'Edit', 'Delete', 'ID', 'Name', 'Phone number', 'Address', 'City'] # Clean btn self.btn_clean = Button( self.frame_1, text=text_label[0], bd=2, font=BTN_FONT_NORMAL, command=self.clean_canvas) self.btn_clean.place(relx=0.2, rely=0.1, relwidth=0.1, relheight=0.1) # Seach btn self.btn_search = Button( self.frame_1, text=text_label[1], bd=2, font=BTN_FONT_NORMAL, command=self.search_client) self.btn_search.place(relx=0.3, rely=0.1, relwidth=0.1, relheight=0.1) # Info msg text_msg = "Please enter in the name field the client which you would like to search." self.info_msg_search = tix.Balloon(self.frame_1) self.info_msg_search.bind_widget(self.btn_search, balloonmsg=text_msg) # New btn self.btn_new = Button( self.frame_1, text=text_label[2], bd=2, font=BTN_FONT_BOLD, command=self.add_client) self.btn_new.place(relx=0.25, rely=0.8, relwidth=0.1, relheight=0.1) # Edit btn self.btn_edit = Button( self.frame_1, text=text_label[3], bd=2, font=BTN_FONT_NORMAL, command=self.edit_client) self.btn_edit.place(relx=0.45, rely=0.8, relwidth=0.1, relheight=0.1) # Delete btn self.btn_delete = Button( self.frame_1, text=text_label[4], bd=2, font=BTN_FONT_NORMAL, command=self.delete_client) self.btn_delete.place(relx=0.65, rely=0.8, relwidth=0.1, relheight=0.1) # Label and Entry # ID - label and entry self.label_id = Label( self.frame_1, text=text_label[5], bg=FRAME_COLOR) self.label_id.place(relx=0.01, rely=0.0, relwidth=0.1) self.id_entry = Entry(self.frame_1, validate="key", validatecommand=self.validate_cmd) self.id_entry.place(relx=0.05, rely=0.1, relwidth=0.1) # Name - label and entry self.label_name = Label( self.frame_1, text=text_label[6], bg=FRAME_COLOR) self.label_name.place(relx=0.028, rely=0.3, relwidth=0.1) self.name_entry = Entry(self.frame_1) self.name_entry.place(relx=0.05, rely=0.4, relwidth=0.7) # Phone - label and entry self.label_phone = Label( self.frame_1, text=text_label[7], bg=FRAME_COLOR) self.label_phone.place(relx=0.789, rely=0.3, relwidth=0.15) self.phone_entry = Entry(self.frame_1) self.phone_entry.place(relx=0.8, rely=0.4, relwidth=0.15) # Address - label and entry self.label_address = Label( self.frame_1, text=text_label[8], bg=FRAME_COLOR) self.label_address.place(relx=0.038, rely=0.5, relwidth=0.1) self.address_entry = Entry(self.frame_1) self.address_entry.place(relx=0.05, rely=0.6, relwidth=0.7) # City - label and entry self.label_city = Label( self.frame_1, text=text_label[9], bg=FRAME_COLOR) self.label_city.place(relx=0.767, rely=0.5, relwidth=0.1) self.city_entry = Entry(self.frame_1) self.city_entry.place(relx=0.8, rely=0.6, relwidth=0.15)