def show_univers(self): i = 0 for cities in self.univers: label = tk.Label(self.top_frame, text=cities[0]['city']) label.grid(row=i, column=0) label.label = False label.collapsed = True label.bind('<1>', self.switch_univers) i += 1 for univer in cities: var = tk.IntVar() checkbutton = tk.Checkbutton(self.top_frame, text=univer['name'], variable=var) checkbutton.var = var checkbutton.grid(row=i, column=0) checkbutton.label = label checkbutton.bind('<1>', self.gen_univers_chosen) i += 1 self.widget_univers = self.top_frame.grid_slaves() for widget in self.widget_univers: if ~str(widget.winfo_class).find('checkbutton'): widget.grid_remove()
def show_filters(self): for i, (key, value) in enumerate(self.filters.items()): label = tk.Label(self.top_frame, text=key) label.grid(row=0, column=i) for j, name in enumerate(value['names']): var = tk.IntVar() btn = tk.Checkbutton(self.top_frame, text=name, variable=var) btn.var = var btn.label = label['text'] btn.grid(row=j + 1, column=i) btn.bind('<1>', self.gen_filter_url) self.widget_filters = self.top_frame.grid_slaves()
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 refresh(self, bundle): # Nustatomas lango pavadinimas self._controller.title(Constants.TITLE_HOME) # Isvalomi pries tai lange buve elementai pasinaudojant elementu is klases WindowUtils (paveldejimas) self.clearWindow() infoLabel = tkx.Label( self, text= "Iveskite didesni uz 0 sveika skaiciu \nis kurio bus sugeneruotas jusu nurodyto dydzio teigiamu skaiciu masyvas" ) infoLabel.pack() self._numberValue = tkx.StringVar(self) self._numberValue.trace("w", self.entryChangeListener) self._threadValue = tkx.StringVar(self) self._threadValue.trace("w", self.entryChangeListener) self._numberEntry = tkx.Entry(self, textvariable=self._numberValue) self._numberEntry.pack() threadInfoLabel = tkx.Label( self, text= "Iveskite sveika skaiciu, kuris nurodys pasirinktu giju kieki (maziausiai 1, daugiausiai 3)" ) threadInfoLabel.pack() self._threadsEntry = tkx.Entry(self, textvariable=self._threadValue) self._threadsEntry.pack() typeInfoLabel = tkx.Label( self, text="Pasirinkite programos veiksmu vykdymo budus") typeInfoLabel.pack() self._choicesFrame = tkx.Frame(self) self._choicesFrame.pack() # CheckBoxes arba kitaip veiksmu vykdymo tipu pasarinkimas self._choices = ("Nuoseklus vykdymas", "Gijomis paremtas vykdymas") self._optionsMenuValue = [] self._optionsMenuButtons = [] for i in range(len(self._choices)): # Nustatoma mygtuko reiksme. 1 - pasirinkta, 0 - nepasirinkta self._optionsMenuValue.append(tkx.IntVar(value=1)) self._optionsMenuValue[i].trace("w", self.entryChangeListener) self._optionsMenuButtons.append( tkx.Checkbutton(self._choicesFrame, text=self._choices[i], variable=self._optionsMenuValue[i], onvalue=1, offvalue=0)) self._optionsMenuButtons[i].pack() self._buttonsFrame = tkx.Frame(self) self._buttonsFrame.pack() self._submitButton = tkx.Button(self._buttonsFrame, text="Vykdyti") self._submitButton.pack( side="left", anchor=tkx.NW, expand=True, ) # Veiksmu vykdyma perkeliu i atskira Thread'a, kad neatsitiktu taip, jog esant dideliam duomenu kiekiui # programa taps "not responding" self._submitButton.config( command=lambda: threading.Thread(target=self.doActions).start(), state='disabled') self._clearButton = tkx.Button(self._buttonsFrame, text="Isvalyti") self._clearButton.pack( side="left", anchor=tkx.NW, expand=True, ) self._clearButton.config(command=partial(self._actionClear)) self._exitButton = tkx.Button(self._buttonsFrame, text="Uzdaryti") self._exitButton.pack( side="left", anchor=tkx.NW, expand=True, ) self._exitButton.config(command=lambda: self._controller.exit()) self._errorLabel = tkx.Label(self, text="") self._errorLabel.pack() self._progressLabel = tkx.Label(self, text="") self._progressLabel.pack()
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)
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) bb.add('face2', text='Facial Features (Small)', command=face2) bb.add('biome', text='Biomes, Types, and Castes', command=biomes) bb.grid(row=1, column=0) bb2 = tix.ButtonBox(frame, orientation=tix.HORIZONTAL) bb2.add('arg', text='Argument Values', command=arguments) bb2.add('speed', text='Gait Speeds', command=speeds) bb2.add('advanced', text='Attributes', command=attributes) bb2.add('variable', text='Variability', command=variable) bb2.grid(row=2, column=1) rcc.numbers['seed'] = tix.IntVar() seedStore = tix.Control(frame, label='Seed', min=0, variable=rcc.numbers['seed'], autorepeat=False, integer=True) seedStore.subwidget('decr').destroy() seedStore.subwidget('incr').destroy() seedStore.grid(row=0, column=2, stick=tix.E) mainBalloon.bind_widget( seedStore, msg= 'Seed used for random number generation, if left at 0 will use a random seed' )