def loginGUI(): # import the library from appJar import gui # handle button events def press(button): if button == "Cancel": app.stop() else: usr = app.getEntry("Username") pwd = app.getEntry("Password") print("User:"******"Pass:"******"Login Window", "378x265") app.setBg("orange") app.setFont(18) # add & configure widgets - widgets get a name, to help referencing them later app.addLabel("title", "Welcome to appJar") app.setLabelBg("title", "blue") app.setLabelFg("title", "orange") app.addLabelEntry("Username") app.addLabelSecretEntry("Password") # link the buttons to the function called press app.addButtons(["Submit", "Cancel"], press) app.setFocus("Username") # start the GUI app.go()
def visuDraw(): global app # print "visudraw" paramdict=pickle.load(open( paramsaveDirf, "rb" )) app = gui("Visualization compare form","1000x600") app.setResizable(canResize=True) app.setBg("lightBlue") # app.decreaseButtonFont(2) app.setFont(10,font=None) app.addButton("HELP", presshelp) lisdircomp=paramdict['path_patient_comp'] lisdirref=paramdict['path_patient_ref'] app.addLabel("path_patientt", "path_patients" ) app.setLabelBg("path_patientt", "Blue") app.setLabelFg("path_patientt", "Yellow") app.addHorizontalSeparator( colour="red" ) app.addLabel("path_patient_ref" ,"path ref :"+lisdirref ) app.setLabelBg("path_patient_ref", "Blue") app.setLabelFg("path_patient_ref", "Yellow") app.addHorizontalSeparator( colour="red" ) app.addLabel("path_patient_comp", "path comp :"+lisdircomp ) app.setLabelBg("path_patient_comp", "Blue") app.setLabelFg("path_patient_comp", "Yellow") app.addButton("Change Patient Dir", selectPatientDirB,colspan=2) app.addButton("Go back to prediction form", initDrawB,colspan=2) app.addHorizontalSeparator( colour="red",colspan=2) app.addLabel("top1", "Select patient to visualize:") some_sg,stsdir,setrefdict=lisdirprocess(lisdirref) listannotated=[] app.startLabelFrame("patient List:") app.setSticky("ew") for user in some_sg: if stsdir[user]['front']==True: lroi=' Cross & Front' listannotated.append(user+' PREDICT!: ' +setrefdict[user]+lroi) elif stsdir[user]['cross']==True: lroi=' Cross' listannotated.append(user+' PREDICT!: '+setrefdict[user]+lroi) else: listannotated.append(user+' noPREDICT! ') app.addListBox("list",listannotated) app.setListBoxMulti("list", multi=False) app.setListBoxRows("list",10) app.stopLabelFrame() # app.addButton("Selection", selection) app.addRadioButton("planar","view") app.addRadioButton("planar","report") app.addHorizontalSeparator( colour="red",colspan=2) app.addButton("Visualisation", visualisation) # app.addButton("Quit", boutonStop) app.go()
def main(): logging.basicConfig() with gui('Generate Kulturens Lists') as app: with app.tabbedFrame('Test'): with app.tab('Konfigurering'): config_load(app) app.addButton("Spara", lambda x: config_save(app)) with app.tab('Generering'): url = app.addLabelEntry('URL till närvarorapporten') username = app.addLabelEntry('Användarnamn till internwebben') password = app.addLabelSecretEntry('Lösenord till internwebben') app.addButton("Generera", lambda: generate(app, url, username, password)) app.addButton("Avsluta", lambda: sys.exit(0)) app.go()
import sys sys.path.append("../../") def changeColour(): app.label("DEMO", bg=app.colourBox()) app.label("DEMO", app.getLabelWidget("DEMO").cget("bg")) from appJar import gui with gui("Colours", "400x400", sticky="news") as app: app.label("DEMO", submit=changeColour)
from appJar import gui app = gui('') app.setFont(20) app.setBg('#00ff55') app.addLabel('l11', 'Move me around') app.addGrip(0, 1) app.addSeparator(1, 0, 2, colour='red') app.go()
app.setTabbedFrameSelectedTab("Tabs", tabName) print("done") # function to get a help message on log-in page def helpMe(nbtn): app.infoBox("Login Help", "Any username/password will do...") # function to update status bar with the time def showTime(): app.setStatusbar(time.strftime("%X")) ########################### ## GUI Code starts here ## ########################### with gui("ShowCase") as app: app.showSplash("appJar Showcase") # add a simple toolbar app.addToolbar(["EXIT", "LOGOUT", "FILL", "PIE-CHART", "CALENDAR", "ADDRESS-BOOK", "MAP", "FULL-SCREEN"], toolbar, findIcon=True) #app.createMenu("Test") app.addMenuPreferences(toolbar) #app.addMenuItem("APPMENU", "About", toolbar) app.addMenuItem("Test", "EXIT", toolbar, shortcut="Option-Control-Shift-Alt-Command-B", underline=2) app.addMenuList("Tabs", ["Login", "Lists", "Properties", "Meters", "Drag'nDrop", "Calculator", "Panes", "Labels"], changeTab) app.addMenuItem("Test", "LOGOUT", toolbar, shortcut="Shift-Command-B", underline=3) app.addMenuItem("Test", "FILL", toolbar, shortcut="Control-Shift-C", underline=1) app.addSubMenu("Test", "Bobs") app.addMenuItem("Bobs", "EXIT", toolbar) app.addMenuItem("Bobs", "LOGOUT", toolbar)
""" # import the library from appJar import gui def update_button(rb): # parameter is radioButton verb = app.getRadioButton("Verb_1") # verb is what the app.getRadioButton clicked adjective = app.getRadioButton("adj_1") app.setLabel("result","Fox say "+ verb + " Cat "+ adjective) # gui set up app = gui("Thing I don't know how to make it work", "800x800") app.setBg("orange") app.setFont(18) # title labe app.addLabel("title",colspan=4) app.setLabelBg("title", "blue") app.setLabelFg("title", "orange") app.setLabel("title", "cat") # link the buttons to the function called update_button app.addRadioButton("Verb_1","why.....",1,0) app.addRadioButton("Verb_1","Ring-ding-ding-ding-dingeringeding!",2,0) app.setRadioButtonChangeFunction('Verb_1',update_button)
def appJarTest(): from appJar import gui app = gui("Example") app.addLabel("label1", "Hello, World!") app.go()
def initDraw(): global app # print goodir paramdict=pickle.load(open( paramsaveDirf, "rb" )) thrpatch= paramdict['thrpatch'] thrproba= paramdict['thrproba'] thrprobaUIP= paramdict['thrprobaUIP'] picklein_file= paramdict['picklein_file'] picklein_file_front= paramdict['picklein_file_front'] subErosion = paramdict['subErosion in mm'] centerHU=paramdict['centerHU'] limitHU=paramdict['limitHU'] app = gui("Predict form","1000x700") app.setResizable(canResize=True) app.setBg("lightBlue") app.setFont(10) app.setStopFunction(Stop) app.addButton("HELP", presshelp) # app.addLabel("top", "Select patient directory:", 0, 0) if not goodir: selectPatientDir() if goodir: app.addLabel("path_patientt", "path_patient",colspan=2) app.addLabel("path_patient", lisdir,colspan=2) app.setLabelBg("path_patient", "Blue") app.setLabelFg("path_patient", "Yellow") app.setLabelBg("path_patientt", "Blue") app.setLabelFg("path_patientt", "Yellow") app.addButton("Change Patient Dir", selectPatientDirB,colspan=2) app.addHorizontalSeparator( colour="red",colspan=2) # app.addHorizontalSeparator( colour="red") app.addLabel("top1", "Select patient for prediction:") app.setLabelBg("top1", "blue") app.setLabelFg("top1", "yellow") some_sg,stsdir,setrefdict=lisdirprocess(lisdir) # print some_sg # print stsdir listannotated=[] for user in some_sg: if stsdir[user]['front']==True: lroi=' Cross & Front' listannotated.append(user+' PREDICT!: ' +setrefdict[user]+lroi) elif stsdir[user]['cross']==True: lroi=' Cross' listannotated.append(user+' PREDICT!: '+setrefdict[user]+lroi) else: listannotated.append(user+' noPREDICT! ') # print listannotated app.addListBox("list",listannotated,colspan=2) app.setListBoxMulti("list", multi=True) app.setListBoxRows("list",10) app.addHorizontalSeparator( colour="red",colspan=1) # app.setFont(8) app.setSticky("w") app.addLabel("l1", "Prediction parameters:") app.setLabelBg("l1","blue") app.setLabelFg("l1","yellow") row = app.getRow() app.addLabelNumericEntry("Percentage of pad Overlapp",row,0) app.setEntry("Percentage of pad Overlapp", thrpatch) app.addLabelNumericEntry("Threshold proba for predicted image generation",row,1) app.setEntry("Threshold proba for predicted image generation", thrproba) row = app.getRow() app.addLabelNumericEntry("Threshold proba for volume calculation",row,0) app.setEntry("Threshold proba for volume calculation",thrprobaUIP) app.addLabelNumericEntry("centerHU",row,1) app.setEntry("centerHU", centerHU) row = app.getRow() app.addLabelNumericEntry("subErosion in mm",row,0) app.setEntry("subErosion in mm", subErosion) # row = app.getRow() # row = app.getRow() app.addLabelNumericEntry("limitHU",row,1) app.setEntry("limitHU", limitHU) row = app.getRow() app.addHorizontalSeparator(row,0,2, colour="red") app.addHorizontalSeparator(row,1,2, colour="red") row = app.getRow() app.addLabel("l2", "CNN weights",row,0) app.setLabelBg("l2","blue") app.setLabelFg("l2","yellow") app.addLabel("l3", "predict type: cross only or cross + front",row,1) app.setLabelBg("l3","blue") app.setLabelFg("l3","yellow") row = app.getRow() app.addLabelEntry("cross view weight",row,0) # app.addVerticalSeparator(row,0 ,colour="red") app.setEntry("cross view weight",picklein_file) app.addRadioButton("predict_style", "Cross Only",row,1) row = app.getRow() app.addLabelEntry("front view weight",row,0) app.setEntry("front view weight",picklein_file_front) app.addRadioButton("predict_style", "Cross + Front",row,1) row = app.getRow() app.addLabel("Fast","Tick for fast run (without store on disk of predict results):",row,0) app.addCheckBox("Fast",row,1) app.setCheckBox("Fast",ticked=True,callFunction=False) # app.setFont(10) app.setSticky("n") app.addHorizontalSeparator( colour="red") app.addButton("Predict", predict) app.addHorizontalSeparator( colour="red") app.addButton("Visualisation", visuDrawl) app.addHorizontalSeparator( colour="red") app.addButton("Quit", boutonStop) app.go()
from appJar import gui # initialize variables total = 0 backup = 0 app = gui("Python Counter", "400x200") title = "Python Counter" # define functions def count(num): """Basic count function +1, +2, +5""" global total global backup global app backup = total if num == "+1": total += 1 elif num == "+2": total += 2 elif num == "+5": total += 5 app.setLabel("total", "Total: " + str(total)) def undo(btn): """Undo the last count""" global total global backup global app total = backup app.setLabel("total", "Total: " + str(total))
app.addListItem("Directories", dir_path) def quit(btn): app.stop() if __name__ == "__main__": config = SafeConfigParser() tmp_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', 'tmp')) conf_file = tmp_dir + "/pwb.ini" config.read(conf_file) app = gui(' Copy wim archive', useTtk=True, colspan=5, showIcon=False) # TODO: Hvordan midtstille tittel uten space først? app.setLocation("CENTER") app.setStretch("column") if os.name == "posix": app.setTtkTheme('scidmint') app.setSize("400x400") else: app.setSize("400x370") app.addLabel("l0", "Choose wim-file:", 0, 0) app.addEntry("wim_path", 1, 0, 5) app.setSticky("ne") app.addButton(" File ", app_add_file, 1, 4, 1)
app.setLabel("title", "Count=" + str(count)) if btn == "PRESS": app.setFg("white") app.setBg("green") elif btn == "PRESS ME TOO": app.setFg("green") app.setBg("pink") elif btn == "PRESS ME AS WELL": app.setFg("orange") app.setBg("red") if count >= 10: app.infoBox("You win", "You got the counter to 10") app = gui("Demo GUI") app.setBg("yellow") app.setFg("red") app.setFont(15) app.addLabel("title", "Hello World") app.addMessage("info", "This is a simple demo of appJar") app.addButton("PRESS", press) app.addButton("PRESS ME TOO", press) app.addButton("PRESS ME AS WELL", press) app.go()
from appJar import gui from random import randint def press(button): app.clearLabel('title') app.setSize('fullscreen') a = randint(1, 17) app.setMessage('title', 'И оценку "5" получает учащийся под номером ' + str(a)) def press1(button): app.stop() print('Кажется, вы испугались') app = gui('Лотерея', '800x400') app.setFont(20) app.addLabel("title", "Лотерея оценок по информатике для 11Т") #app.setLabelBg('title', 'orange') app.addEmptyMessage('title') app.addButton('Вперёд!', press) app.addButton('Назад', press1) app.go()
import argparse import os from appJar import gui app = gui("Test App", '400x200', useTtk=True, handleArgs=False) app.info('Created GUI!') app.info('Showing splash!') pwd = os.getcwd() parser = argparse.ArgumentParser( description='Get a pretty version of your common songs!', epilog="And that's how you wubbalubbadub a simple dub") parser.add_argument("-a", "--action", default=pwd, help="This is the 'a' variable") parser.add_argument('-v', '--verbose', default=False, help='Run verbosely') args = parser.parse_args() a = args print(a) def press(): filepath = app.getEntry('Files') with open(filepath) as path: line = path.readline() cnt = 1 while line: app.addLabel(cnt.__str__(), line.strip())
from appJar import gui win=gui('Login') win.addLabel('lb1','Login Window') win.setBg('green') win.setFg('white') win.setFont(16) win.addLabelEntry('Username') win.addSecretLabelEntry('Password') win.addStatusbar() win.setStatusbar('New status...') username=None password=None def press(name): print(name,'pressed') if name=='Cancel': win.stop() elif name=='Reset': win.clearAllEntries() win.setFocus('Username') elif name=='Submit': username=win.getEntry('Username') password=win.getEntry('Password') if username!='asd': win.errorBox('Wrong name','Invalid Username') elif password!='password': win.errorBox('Wrong Password','Invalid password') elif password=='password': win.infoBox('Success','Valid password') win.addButtons(['Submit','Reset','Cancel'],press) win.go()
def recipeGUI(selected_items): ### Load data filter_tag_list=[] recipe_dir="..\\recipes" a_list = grocery_functions.get_recipe_names(recipe_dir, filter_tag_list) all_recipes ={} for item in a_list: all_recipes[item] = False suggest_recipes = all_recipes.copy() menu_recipes = {} rand_suggestion = random.choice(list(suggest_recipes)) ### Configure app_title = "Menu Builder" section_1_title="Recepies" section_2_title="Random Suggestion" section_3_title="Current Menu" section_4_title="Search by Tag" button_name_add_selected = "Add Selected" button_name_new_selection = "New Suggestion" button_name_add_selection = "Add Suggestion" button_name_filter = "Filter Recipes" button_name_no_save_quit = "Quit" button_name_remove_items = "Remove Selected" button_name_save_quit = "Save and Quit" button_8 = "b8" ### debug constants # rand_suggestion = "poo" ### Function defs def press(button): if button == button_name_add_selected: add_selected_button_action() elif button == button_name_new_selection: new_suggest_button_action() elif button == button_name_add_selection: add_suggestion_button_action() elif button == button_name_no_save_quit: no_save_quit_button_action() elif button == button_name_remove_items: remove_items_button_action() elif button == button_name_save_quit: save_quit_button_action() elif button == button_name_filter: filter_recipes_button_action() elif button == button_8: print(button) else: print(button+" is not a recognised button") app.stop() ### def new_suggest_button_action(): rand_sug = random.choice(list(suggest_recipes)) app.setLabel(section_2_title, rand_sug) def add_suggestion_button_action(): rand_suggestion = app.getLabel(section_2_title) app.setProperty(section_3_title, rand_suggestion) def remove_items_button_action(): current_menu = app.getProperties(section_3_title) for item in current_menu: if current_menu[item]: app.deleteProperty(section_3_title, item) def filter_recipes_button_action(): filter_tag_list=app.getEntry(section_4_title).split() a_list = grocery_functions.get_recipe_names(recipe_dir, filter_tag_list) # a_list = grocery_functions.get_recipe_names(recipe_dir, filter_tag_list) filtered_recipes = {} for item in a_list: filtered_recipes[item] = False for item in app.getProperties(section_1_title): app.deleteProperty(section_1_title, item) app.setProperties(section_1_title, filtered_recipes) #suggest_recipes = all_recipes.copy() #rand_suggestion = random.choice(list(suggest_recipes)) def add_selected_button_action(): all_rec = app.getProperties(section_1_title) for item in all_rec: if all_rec[item]: app.setProperty(section_3_title, item) app.setProperty(section_1_title, item, False) def no_save_quit_button_action(): app.stop() def save_quit_button_action(): nonlocal selected_items for i in list(app.getProperties(section_3_title)): selected_items.append(i) app.stop() ### initialization look and feel app = gui() app.setBg("lightBlue") app.setFont(12) ### add widgets # title app.addLabel("title", app_title, 0, 0,) app.setLabelBg("title", "orange") app.addButton(button_name_no_save_quit, press, 4,0) app.addButton(button_name_save_quit, press, 4,2) # select recipe panel app.addEntry(section_4_title,1,0,1,1) app.startScrollPane("Pane1", 2, 0) app.addProperties(section_1_title, all_recipes) app.stopScrollPane() app.addButtons([button_name_add_selected, button_name_filter], press, 3,0) # random suggestion panel app.addLabel(section_2_title, rand_suggestion, 1, 1,) app.setLabelBg(section_2_title, "orange") app.addButtons([button_name_new_selection, button_name_add_selection], press, 2,1) # current selection panel app.addProperties(section_3_title, menu_recipes, 1,2) app.addButton(button_name_remove_items, press, 2,2) ### go app.go()
# experiment to test out appjar from appJar import gui import thisis_gamma import turtle turtle_shapes = ['classic', 'arrow', 'turtle', 'circle', 'square', 'triangle'] app = gui("test", "600x400") app.setFont(20) thisis = thisis_gamma.Thisis() trtl = turtle.Pen() trtl.shape('square') # trtl.shapesize(1, 1) trtl.speed(10) def press(what): print(what) def text_bttn(_arg): thisis.text_buffer.string_to_buffer(app.getTextArea('textbox')) ret_msg_list = thisis.self_buffer_parse() for msg in ret_msg_list:
#!/usr/bin/env python from appJar import gui def onButtonPress(buttonName): if buttonName == "Quit": app.stop() else: msg = "Your choice: {c}".format(c=app.getRadioButton("languages")) app.infoBox("Show choices:", msg) app = gui() app.setSticky("news") app.setPadding(10, 2) app.addRadioButton("languages", "Assembler", 1, 1) app.addRadioButton("languages", "C", 2, 1) app.addRadioButton("languages", "C++", 3, 1) app.addRadioButton("languages", "Perl", 4, 1) app.addRadioButton("languages", "Python", 5, 1) app.setRadioTick("languages", tick=False) app.addButton("Show choice", onButtonPress, 6, 1) app.addButton("Quit", onButtonPress, 6, 2) app.go()
def initDraw(goodir): global app app = gui("Compare form","1000x800") app.setResizable(canResize=True) app.setBg("lightBlue") app.setFont(10) app.setStopFunction(Stop) app.addButton("HELP", presshelp) # app.addLabel("top", "Select patient directory:", 0, 0) if not (goodir): goodir=selectPatientDir() if goodir: lisdircomp=paramdict['path_patient_comp'] lisdirref=paramdict['path_patient_ref'] app.addLabel("path_patientt", "path_patients" ) app.setLabelBg("path_patientt", "Blue") app.setLabelFg("path_patientt", "Yellow") app.addHorizontalSeparator( colour="red" ) app.addLabel("path_patient_ref" ,"path ref :"+lisdirref ) app.setLabelBg("path_patient_ref", "Blue") app.setLabelFg("path_patient_ref", "Yellow") app.addHorizontalSeparator( colour="red" ) app.addLabel("path_patient_comp", "path comp :"+lisdircomp ) app.setLabelBg("path_patient_comp", "Blue") app.setLabelFg("path_patient_comp", "Yellow") app.addButton("Change Patient Dir", selectPatientDirB,colspan=2) app.addHorizontalSeparator( colour="red" ) # app.addHorizontalSeparator( colour="red") some_sg_ref,stsdir_ref,setrefdict_ref=lisdirprocess(lisdirref) some_sg_comp,stsdir_comp,setrefdict_comp=lisdirprocess(lisdircomp) # print some_sg print 'setrefdict_ref',setrefdict_ref print 'setrefdict_comp',setrefdict_comp listannotatedref=[] for user in some_sg_ref: if stsdir_ref[user]['front']==True: lroi=' Cross & Front' listannotatedref.append(user+' PREDICT!: ' +setrefdict_ref[user]+lroi) elif stsdir_ref[user]['cross']==True: lroi=' Cross' listannotatedref.append(user+' PREDICT!: '+setrefdict_ref[user]+lroi) else: listannotatedref.append(user+' noPREDICT! ') print 'listannotatedref',listannotatedref # row = app.getRow() app.addListBox("listref",listannotatedref,colspan=2) app.setListBoxMulti("listref", multi=True) app.setListBoxRows("listref",10) app.addHorizontalSeparator( colour="red",colspan=1) listannotatedcomp=[] for user in some_sg_comp: if stsdir_comp[user]['front']==True: lroi=' Cross & Front' listannotatedcomp.append(user+' PREDICT!: ' +setrefdict_comp[user]+lroi) elif stsdir_comp[user]['cross']==True: lroi=' Cross' listannotatedcomp.append(user+' PREDICT!: '+setrefdict_comp[user]+lroi) else: listannotatedcomp.append(user+' noPREDICT! ') # print listannotated print 'listannotatedcomp',listannotatedcomp app.addListBox("listcomp",listannotatedcomp,colspan=2) app.setListBoxMulti("listcomp", multi=True) app.setListBoxRows("listcomp",10) app.addHorizontalSeparator( colour="red",colspan=1) app.addButton("Calculate", calculate) app.addButton("Visualisation", visuDrawl) app.addButton("Report All", gscore) app.addButton("Quit", boutonStop) app.go()
#!/usr/bin/env python """ The GUI for the software organiser. """ import _thread import appJar from software_program import SoftwareProgram from software_license_organiser import SoftwareLicenseOrganiser from license_web_analyzer import LicenseWebAnalyzer APP = appJar.gui("Software Organiser", "800x500", useTtk=True) CATALOG = SoftwareLicenseOrganiser("softwares.pi") ANALIZER = LicenseWebAnalyzer() scanning_in_progress = False hide_files_not_containing_paths = False hide_files_not_containing_licenses = False license_directory = "" software_search_value = "" license_search_value = "" def create_software_list(software_list, row: int, column: int, colspan=0, rowspan=0): """ Creates a Frame with a ListBox in which the list of softwares is shown. """ APP.startFrame("Software List Frame", row, column, colspan, rowspan)
def myGUITest(): from appJar import gui app = gui() app.addLabel("title", "My First GUI with appJar") app.setLabelBg("title","red") app.go()
print scannerDesc for dev in scannerliste: if (dev in scannerDesc) == True: scanner = dev #INI setzen config.set('scannerklasse', 'scanner', scanner) with open(ini, "w") as configfile: config.write(configfile) else: scanner = "---" bell.hideSubWindow("Scanner") bell.showSubWindow("Einstellungen") #Hauptmenu bell = gui("Hauptmenu", "800X200") bell.setResizable("False") bell.setStretch("Couluomn") bell.setSticky("ew") bell.setFont(size=12, family="Sans Serif") #bell.showSplash("*Name einfuegen*", fill='black', stripe='black', fg='white', font=40) bell.addLabel("titel", "Willkommen bei der BETA von ISBN2BibTeX!") bell.getLabelWidget("titel").config(font=("Sans Serif", "20", "bold")) bell.setStretch("None") bell.addLabel("untertitel1", "Wählen Sie eine Bibliotheksdatei aus und") bell.addLabel( "untertitel2", "scannen Sie eine ISBN ein, um dieses Buch zu ihrem Literaturverzeichnis hinzuzufügen." ) bell.setStretch("both") bell.addButtons(["Bibliotheksdatei", "ISBN", "Einstellungen", "Abbrechen"],
from appJar import gui # create the GUI & set a title app = gui("Login Form") def press(btnName): if btnName == "Cancel": app.stop() return if app.getEntry("userEnt") == "rjarvis": if app.getEntry("passEnt") == "abc": app.infoBox("Success", "Congratulations, you are logged in!") else: app.errorBox("Failed login", "Invalid password") else: app.errorBox("Failed login", "Invalid username") # add labels & entries # in the correct row & column app.addLabel("userLab", "Username:"******"userEnt", 0, 1) app.addLabel("passLab", "Password:"******"passEnt", 1, 1) # changed this line to call a function app.addButtons( ["Submit", "Cancel"], press, colspan=2) # add some enhancements app.setFocus("userEnt") app.enableEnter(press)
two_dec_result = round((max_val/(count-BG))*100,2) write_data.append(str(two_dec_result)+ '%') # Write into scv file # 3-21 Updated with open('data.csv','a') as csvfile: fieldnames = ['Video_name','Month','Date','Species','Abundance','Starting_Time','Ending_Time','Activity_Hour','Second_Hour','Activity_Time(Sec)','Probability'] writer = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) #writer.writerow(fieldnames) writer.writerow(write_data) # create a GUI variable called app app = gui("Address input form", "400x200") app.setBg("white") app.setFont(18) # add & configure widgets - widgets get a name, to help referencing them later app.addLabel("title", "Welcome,please input the file path") app.setLabelBg("title", "white") app.setLabelFg("title", "gray") app.addLabelEntry("Path") #app.addLabelSecretEntry("Password") # link the buttons to the function called press app.addButtons(["Submit", "Cancel"], press) app.setFocus("Path")
# function to create the explorer SubWindow explorer = None def makeExplorer(): # this makes the new SubWindow global explorer if explorer is None: explorer = appJarExplorer(app) explorer.showExplorer() # make a dummy GUI with gui("appJar Explorer") as app: with app.tabbedFrame("tf"): app.setTabbedFrameActiveBg("tf", 'pink') with app.tab("a"): app.label("Title Label", colspan=2) app.label("DETAILS", "") app.entry("DETAILS2") app.entry("files", kind='file', label=True) app.buttons(['a', 'b'], None) app.check("check") app.radio("radio", "r1") # pressing the button creates the explorer app.button("DETAILS", makeExplorer) for t in ['b', 'c', 'd', 'e', 'f']: with app.tab(t): app.label(t)
def plotdata(self): times = [] degrees_list = [] pressure_list = [] humidity_list = [] temp_ave = [] temp_unc = [] pressure_ave = [] pressure_unc = [] humidity_ave = [] humidity_unc = [] merge_times = [] app = gui("Weather Plot", "800x400") app.addLabel("1", "Please choose a following .csv file") file_name = [] for filename in os.listdir('.'): if filename.endswith(".csv"): file_name.append(os.path.join('.', filename)) app.setFont(20) app.addOptionBox("Files", file_name) app.setOptionBoxHeight("Files", "4") app.addLabel("2", "Enter the number of data points to merge:") app.setLabelFont("20", "Heletica") app.addNumericEntry("n") app.setFocus("n") def ok(btn): user_file = app.getOptionBox("Files") n_merge = int(app.getEntry("n")) row_counter = 0 results = csv.reader(open(user_file), delimiter=',') for r in results: if row_counter > 0: times.append(dateutil.parser.parse(r[0])) degrees_list.append(float(r[1])) pressure_list.append(float(r[2])) humidity_list.append(float(r[3])) row_counter += 1 ndata = int(len(degrees_list)) nsum_data = int(ndata / n_merge) for i in range(nsum_data): itemp = degrees_list[i * n_merge:(i + 1) * n_merge] itemp_array = np.asarray(itemp) temp_mean = np.mean(itemp_array) temp_sigma = np.sqrt(np.var(itemp_array)) temp_ave.append(temp_mean) temp_unc.append(temp_sigma) for i in range(nsum_data): ipressure = pressure_list[i * n_merge:(i + 1) * n_merge] ipressure_array = np.asarray(ipressure) pressure_mean = np.mean(ipressure_array) pressure_sigma = np.sqrt(np.var(ipressure_array)) pressure_ave.append(pressure_mean) pressure_unc.append(pressure_sigma) for i in range(nsum_data): ihumid = humidity_list[i * n_merge:(i + 1) * n_merge] ihumid_array = np.asarray(ihumid) humid_mean = np.mean(ihumid_array) humid_sigma = np.sqrt(np.var(ihumid_array)) humidity_ave.append(humid_mean) humidity_unc.append(humid_sigma) for i in range(nsum_data): itimes = times[i * n_merge:(i + 1) * n_merge] itime = itimes[int(len(itimes) / 2)] merge_times.append(itime) fig = plt.figure() ax = fig.add_subplot(111) plt.plot(merge_times, temp_ave, "b.") plt.errorbar(merge_times, temp_ave, yerr=temp_unc) plt.title("Temperature") plt.xlabel("Time(s)") plt.ylabel("Temperature(C)") fig.autofmt_xdate() ax.xaxis.set_major_formatter(DateFormatter('%H:%M:%S')) fig = plt.figure() ax = fig.add_subplot(111) plt.plot(merge_times, pressure_ave, "g.") plt.errorbar(merge_times, pressure_ave, yerr=pressure_unc) plt.title("Pressure") plt.xlabel("Time(s)") plt.ylabel("Pressure(hPa)") fig.autofmt_xdate() ax.xaxis.set_major_formatter(DateFormatter('%H:%M:%S')) fig = plt.figure() ax = fig.add_subplot(111) plt.plot(merge_times, humidity_ave, "r.") plt.errorbar(merge_times, humidity_ave, yerr=humidity_unc) plt.title("Humidity") plt.xlabel("Time(s)") plt.ylabel("Humidity(%)") fig.autofmt_xdate() ax.xaxis.set_major_formatter(DateFormatter('%H:%M:%S')) plt.show() app.addButton("OK", ok) app.setButtonWidth("OK", "20") app.setButtonHeight("OK", "4") app.setButtonFont("20", "Helvetica") app.go()
import sys sys.path.append("../") from appJar import gui app = gui("SCROLLPABE DEMO", "150x150") app.startScrollPane("PANE") for x in range(10): for y in range(10): name = str(x) + "-" + str(y) app.addLabel(name, name, row=x, column=y) app.setLabelBg(name, app.RANDOM_COLOUR()) app.stopScrollPane() app.go()
def relay2(btn): if GPIO.input(12) == True: GPIO.output(12, GPIO.LOW) else: GPIO.output(12, GPIO.HIGH) def color_change(): R.start(app.getScale("Red")) G.start(app.getScale("Green")) B.start(app.getScale("Blue")) try: app = gui("Control", "600x500") app.setFont(17) app.addLabel("Status", "Status:") app.addLabel("Direction", "None") app.addLabel("Moving", "Moving Direction:") app.addLabel("Move", "None") app.addLabel("Speed", "Speed:") app.addLabel("vel", "0") app.setLabel("vel", vel) app.addLabelScale("Red") app.setScaleRange("Red", 0, 100, curr=None) app.showScaleValue("Red", show=True) app.addLabelScale("Green") app.setScaleRange("Green", 0, 100, curr=None) app.showScaleValue("Green", show=True) app.addLabelScale("Blue")
if btn == "Cancel": app.stop() else: runstuff() if __name__ == '__main__': if len(sys.argv) == 3: try: one = int(sys.argv[1]) two = int(sys.argv[2]) print(mainprogram(one, two)) except ValueError: print('Pass two integers as the arguments!') else: app = gui("Password Generator", "450x581") app.setFont(16) app.addLabel("title", "Random Password Generator", 0, 0, 3) # Row 0,Column 0,Span 2 app.addLabel("numbers", "Numbers:", 1, 0) # Row 1,Column 0 app.addRadioButton("numnum", '0', 1, 1) app.addRadioButton("numnum", '1', 2, 1) # Row 1,Column 1 app.addRadioButton("numnum", '2', 3, 1) app.addRadioButton("numnum", '3', 4, 1) app.addLabel("symbs", "Symbols: ", 5, 0) app.addRadioButton("numsym", '0', 5, 1) app.addRadioButton("numsym", '1', 6, 1) # Row 1,Column 1 app.addRadioButton("numsym", '2', 7, 1) app.addRadioButton("numsym", '3', 8, 1) app.addCheckBox("Random capitalization?", 9, 1) app.addButtons(["Submit", "Cancel"], press, 10, 0,
date_rdz[int(item[-2:]) - 1] = dictionary[item] last_message_new[int( item[-2:] ) - 1] = "Pour toutes questions, tu peux m'appeler au " + numero_contact[ int(item[-2:]) - 1] + ".\n" + "La date de rendez-vous est : " + date_rdz[int( item[-2:] ) - 1] + ". Le lieu de rendez-vous est : " + lieu_rdz[ int(item[-2:]) - 1] + ".\nPreviens-nous si tu as un retard." + "\nA très bientôt !" print(numero_contact) print(last_message_new[0]) ##################################################################################### app = gui("Main tendue") app.showSplash('Main tendue', fill='red', stripe='black', fg='white', font=100) # app.setSize("Fullscreen") app.setFont(10) try: wb = load_workbook(filename='Liste de bénéficiaires.xlsx') except: app.infoBox( "Erreur", "Le fichier excel Liste de bénéficiaires n'a pas pu être chargé. Vérifiez que le fichier est présent dans le même dossier que l'application. Vérifiez aussi que le nom du fichier est bien : Liste de bénéficiaires", parent=None) app.stop() ws = wb['Bénévoles'] global now_ global now
if meter_show1 == False: app.hide() def show(): sleep(1) app.show() charge = False ########################## # GUI of battery meter # ########################## with gui(size="60x35") as app: # Set GUI options app.setGuiPadding(0, 0) app.setLocation(0, 565) app.hideTitleBar() app.setBg("white") canvas = app.addCanvas("c") canvas.config(bd=0, highlightthickness=0) rec_list = [] count = 0 for i in range(9): r = app.addCanvasRectangle("c", count, 0, 6, 35, fill="green", width=0) # Add rectangles for bars rec_list.append(r) # Adds rectangles to list count += 6
s7=ss['start7'], s8=ss['start8'], e1=ss['end1'], e2=ss['end2'], e3=ss['end3'], e4=ss['end4'], e5=ss['end5'], e6=ss['end6'], e7=ss['end7'], e8=ss['end8'],) session.add(s) session.commit() with open(file, 'w') as configfile: c.write(configfile) inst.stop() def file_picker(): inst.setEntry('file', inst.saveBox('save', fileExt='.db')) inst = gui('TaktTimer Installer', GUIConfig.windowSize[GUIConfig.platform]) with inst.pagedWindow('Pages'): with inst.page(sticky='news'): inst.addMessage('Installer0', 'Welcome to the Installer!') with inst.page(sticky='n'): inst.addMessage('Installer1', 'First, what type of install will this be?') inst.addOptionBox('type', ['-Select-', 'Server', 'Team Lead', 'Worker']) inst.addOptionBox('area', ['-Select-', 'Talladega', 'Brickyard', 'Ace Post Leach']) inst.setOptionBoxChangeFunction('type', set_type) inst.setOptionBoxChangeFunction('area', set_area) with inst.page(sticky='n'): inst.addMessage('Installer2', 'Second, where will the data be stored?') inst.addEntry('file', row=1, column=0) inst.addButton('select', file_picker) inst.addButton('Install', install)
def __init__(self): app = gui("DOCUMENT SCANNER", "1350x710") app.setBgImage("done.jpg") app.go()
from appJar import gui import random def modifyScale(): app.setMessage("Output", str(app.getAllScales())) def randomize(): app.openFrame("SlidersFrame") for i in range(DimensionN): app.setScale(str(i), 100*random.random(), callFunction=True) app.stopFrame() app = gui("Interface") app.setFont(14) app.startFrame("SlidersFrame", row=0, column=0) DimensionN = 5 for i in range(DimensionN): app.addLabelScale(str(i)) app.setScaleChangeFunction(str(i),modifyScale) app.stopFrame() app.startFrame("OutputFrame",row=0,column=1) app.addMessage("Output", "") app.setMessageWidth("Output", 100) app.stopFrame() app.addButton("Randomize", randomize)
elif (gtype == "strip-dot graph"): gtype = '-.' elif (gtype == "dot graph"): gtype = ':' elif (gtype == 'Points'): gtype = 'ro' settingsfile['graphtype'] = gtype global graphtype graphtype = gtype with open('filename.pickle', 'wb') as handle: pickle.dump(settingsfile, handle) ############################################################################################################### app = gui("UNNAMED") app.setBg("lightBlue") app.setGeom("fullscreen") app.setFont(20) app.addToolbar( ["TEMP1", "TEMP2", "TEMP3", "TEMP4", "About", "Full Screen", "Exit"], toolbar, findIcon=True) app.addStatusbar(header="STATUS ", fields=1, side="RIGHT") app.setStatusbarWidth(20, field=0) app.setStatusbar("ready", field=0) app.startTabbedFrame("VIEW") app.startTab("Portfolio Management")
if button == "Process": src_file = app.getEntry("Input_File") dest_dir = app.getEntry("Output_Directory") page_range = app.getEntry("Page_Ranges") out_file = app.getEntry("Output_name") errors, error_msg = validate_inputs(src_file, dest_dir, page_range, out_file) if errors: app.errorBox("Error", "\n".join(error_msg), parent=None) else: split_pages(src_file, page_range, Path(dest_dir, out_file)) else: app.stop() # Create the GUI Window app = gui("PDF Splitter", useTtk=True) app.setTtkTheme("default") # Uncomment below to see all available themes # print(app.getTtkThemes()) app.setSize(500, 200) # Add the interactive components app.addLabel("Choose Source PDF File") app.addFileEntry("Input_File") app.addLabel("Select Output Directory") app.addDirectoryEntry("Output_Directory") app.addLabel("Output file name") app.addEntry("Output_name")
app.clearAllEntries() app.clearAllTextAreas() def title(btn): # if addresses are in lowercase this will place it in title case text = app.getEntry("Text") app.setEntry("Text", text.title()) def lower(btn): # if email is present this will place it in lower case text = app.getEntry("Text") app.setEntry("Text", text.lower()) # establishes gui size and design app = gui('Work Tool', useTtk=True) app.setTtkTheme("winnative") app.setSize("800x800") # starts tabbed frame app.startTabbedFrame("MAIN") # start tabbed frame app.startTab("Call Notes") app.addLabel("Member ID:") app.addEntry("ID") app.addLabel("Callers Name:") app.addEntry("Name") app.addLabel("Telephone Number:") app.addEntry("Telephone") app.addLabel("Name of drug:")
app.setLabel('input', 'Speech Sample: {}\n'.format(fname)) # maybe split this # output = subprocess.run(['./type_token_ratio.py', fname], # stdout=subprocess.PIPE) results = type_token_ratio.main(fname) app.clearTextArea('results', callFunction=False) app.setTextArea('results', '{}'.format(results), callFunction=False) def exit_ttr(name): app.stop() # create the GUI & set a title app = gui('Type Token Ratio Calculator') license = [ '='*80, '\n Copyright (C) 2013 Steven C. Howell\n', '\n', 'This program is free software: you can redistribute it and/or modify\n', 'it under the terms of the GNU General Public License as published by\n', 'the Free Software Foundation, either version 3 of the License, or\n', '(at your option) any later version.\n', '\n', 'This program is distributed in the hope that it will be useful,\n', 'but WITHOUT ANY WARRANTY; without even the implied warranty of\n', 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n', 'GNU General Public License for more details.\n', '\n',
app.setTabbedFrameSelectedTab("Tabs", tabName) print("done") # function to get a help message on log-in page def helpMe(nbtn): app.infoBox("Login Help", "Any username/password will do...") # function to update status bar with the time def showTime(): app.setStatusbar(time.strftime("%X")) ########################### ## GUI Code starts here ## ########################### app = gui("ShowCase") app.showSplash("appJar Showcase") # add a simple toolbar app.addToolbar(["EXIT", "LOGOUT", "FILL", "PIE-CHART", "CALENDAR", "ADDRESS-BOOK", "FULL-SCREEN"], toolbar, findIcon=True) #app.createMenu("Test") app.addMenuPreferences(toolbar) #app.addMenuItem("APPMENU", "About", toolbar) app.addMenuItem("Test", "EXIT", toolbar, shortcut="Option-Control-Shift-Alt-Command-B", underline=2) app.addMenuList("Tabs", ["Login", "Lists", "Properties", "Meters", "Drag`nDrop", "Calculator", "Panes", "Labels"], changeTab) app.addMenuItem("Test", "LOGOUT", toolbar, shortcut="Shift-Command-B", underline=3) app.addMenuItem("Test", "FILL", toolbar, shortcut="Control-Shift-C", underline=1) app.addSubMenu("Test", "Bobs") app.addMenuItem("Bobs", "EXIT", toolbar) app.addMenuItem("Bobs", "LOGOUT", toolbar)
"----------------------------------------------------------------\n" "This program comes with ABSOLUTELY NO WARRANTY\n" "This is free software, and you are welcome to redistribute it " "under certain conditions.") # Stop SubWindow app.stopSubWindow() # The main start function def main(): set_main() set_sub_config() set_sub_info() # Check the config file config_rw.init_check(the_loader.get_paths("config_path")) # Auto OAuth app.thread(auto_oauth) # When all is set and done app.go() if __name__ == "__main__": app = appJar.gui() main()
import pygame, sys from pygame.locals import * SPEAKER_ID = '000' FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 CHUNK = 1024 RECORD_SECONDS = 5 DATA_LOCATION = "/Volumes/Babelfish/test" recording = False counter = count(0) app = gui("Audio Data Collection", "800x400") prompt_id = [] audio = pyaudio.PyAudio() num_timit_prompts = 15 # import the prompts from timit_prompts.txt timit_prompts = np.load('timit_prompts.npy') digits = 'Please count from 1 to 10.' #digits, then timit prompts, then longer grandfather and rainbow and caterpillar prompts = [[digits, 'digits']] for x in range(num_timit_prompts): prompts.append(timit_prompts[x][:])
contents = pyperclip.paste() if contents != self.last_clip: print("got clip: {}".format(contents)) self.last_clip = contents if self.is_valid_url(contents): self.app.setEntry("Link", contents) else: print("Not valid") def is_valid_url(self, string): for site_string in self.urls: for url in site_string: if url in string: return True return False app = gui("svtplay-dl GUI", "700x400") default_download_path = get_setting("paths", "defaultpath") svpdl = svplay_dl(default_download_path, get_subs=True, remux=True) clip = clipboard(app) app.setPadding([20, 20]) app.addLabel("title", "svtplay-dl") app.addLabelEntry("Link") app.addDirectoryEntry("Output Dir") app.setEntryDefault("Output Dir", default_download_path) app.addButtons(["Download", "Cancel"], submit_button_press) app.registerEvent(clip.check) app.go()
def myGUIMain(): app = gui("", "778x500") text=" ----- L A V A ' S D E B U G G E R -------" #app.showSplash(text, fill='blue', stripe='black', fg='white', font=44) HandleMenu(app) app.go()
import pyautogui import appJar def buttonPress(button): if (button == "Go"): amount = int(app.getEntry("amount")) button = app.radioButton("click") if button == "Right click": button = "right" else: button = "left" for _ in range(amount): pyautogui.click(button=button) app = appJar.gui("Autoclicker for Butts") app.setSize("500x400") app.setSticky("new") app.addLabel("Enter amount of clicks", row=0) app.addEntry("amount", row=1) app.addButton("Go", buttonPress, row=3) app.setSticky("e") app.radioButton("click", "Right click", row=2) app.setSticky("w") app.radioButton("click", "Left click", row=2) app.go()
def visuDraw(): global app # print "visudraw" paramdict=pickle.load(open( paramsaveDirf, "rb" )) app = gui("Visualization form","1000x600") app.setResizable(canResize=True) app.setBg("lightBlue") # app.decreaseButtonFont(2) app.setFont(10,font=None) app.addButton("HELP", presshelp) app.addLabel("path_patientt", "path_patient",colspan=2) app.addLabel("path_patient", lisdir,colspan=2) app.setLabelBg("path_patient", "Blue") app.setLabelFg("path_patient", "Yellow") app.setLabelBg("path_patientt", "Blue") app.setLabelFg("path_patientt", "Yellow") app.addButton("Change Patient Dir", selectPatientDirB,colspan=2) app.addButton("Go back to prediction form", initDrawB,colspan=2) app.addHorizontalSeparator( colour="red",colspan=2) thrprobaUIP=paramdict['thrprobaUIP'] if goodir: if not continuevisu: app.addLabel("top1", "Select patient to visualize:") app.setLabelBg("top1", "blue") app.setLabelFg("top1", "yellow") some_sg,stsdir,setrefdict=lisdirprocess(lisdir) listannotated=[] app.startLabelFrame("patient List:") app.setSticky("ew") for user in some_sg: if stsdir[user]['front']==True: lroi=' Cross & Front' listannotated.append(user+' PREDICT!: ' +setrefdict[user]+lroi) elif stsdir[user]['cross']==True: lroi=' Cross' listannotated.append(user+' PREDICT!: '+setrefdict[user]+lroi) else: listannotated.append(user+' noPREDICT! ') app.addListBox("list",listannotated) app.setListBoxMulti("list", multi=False) app.setListBoxRows("list",10) app.stopLabelFrame() app.addButton("Selection", selection) else: row = app.getRow() # get current row app.addLabelNumericEntry("Threshold proba",row,0) app.setEntry("Threshold proba",thrprobaUIP) selectpatient=str(paramdict['lispatientselect'][0]) frontexist=selectpatient.find('Cross & Front') if frontexist>0: frontpredict=True else: if paramdict['threedpredictrequest'] =='Cross Only': frontpredict=False else: frontpredict=True posb=selectpatient.find(' ') selectpatient=selectpatient[0:posb] app.addLabel("l11", "Patient selected: "+selectpatient) app.addButton("Go back to Selection", gobackselection) app.setLabelBg("l11","blue") app.setLabelFg("l11","yellow") app.addHorizontalSeparator( colour="red") app.setSticky("w") if not frontpredict: row = app.getRow() # get current row app.addLabel("l1", "Type of planar view,select one",row,0) app.addLabel("l2", "Type of orbit 3d view,select one",row,1) app.setLabelBg("l1","blue") app.setLabelFg("l1","yellow") app.setLabelBg("l2","blue") app.setLabelFg("l2","yellow") row = app.getRow() # get current row app.addRadioButton("planar","cross view",row,0) app.addRadioButton("planar","from cross predict",row,1) row = app.getRow() # get current row app.addRadioButton("planar","volume view from cross",row,0) app.addRadioButton("planar","reportCross") else: row = app.getRow() # get current row app.addLabel("l1", "Type of planar view,select one",row,0) app.addLabel("l2", "Type of orbit 3d view,select one",row,1) app.setLabelBg("l1","blue") app.setLabelFg("l1","yellow") app.setLabelBg("l2","blue") app.setLabelFg("l2","yellow") row = app.getRow() # get current row # app.addRadioButton("planar","none",row,0) # app.addRadioButton("3d","none",row,1) app.addRadioButton("planar","cross view",row,0) app.addRadioButton("planar","from cross predict",row,1) row = app.getRow() # get current row app.addRadioButton("planar","volume view from cross",row,0) app.addRadioButton("planar","from front predict",row,1) row = app.getRow() # get current row app.addRadioButton("planar","volume view from front",row,0) app.addRadioButton("planar","from cross + front merge",row,1) app.addRadioButton("planar","front view") app.addRadioButton("planar","front projected view") app.addRadioButton("planar","merge view") app.addLabel("Report", "Report Selection") app.setLabelBg("Report","blue") app.setLabelFg("Report","yellow") row = app.getRow() app.addRadioButton("planar","reportCross",row,0) app.addRadioButton("planar","reportFront",row,1) app.addRadioButton("planar","reportMerge",row,2) app.addHorizontalSeparator( colour="red") app.setSticky("n") # app.setStrech("row") app.addHorizontalSeparator( colour="red",colspan=1) # app.setFont(10) app.addButton("Visualisation", visualisation) app.addHorizontalSeparator( colour="red") app.addButton("Quit", boutonStop) app.go()
import sys sys.path.append("../../") from appJar import gui app=gui("Languages") app.addLabel("l1", "default text") app.addLabel("l2", "default text") app.addLabel("l3", "default text") app.addButtons(["ENGLISH", "FRENCH", "KOREAN"], app.changeLanguage) app.go("ENGLISH")
from pptx.enum.text import PP_ALIGN from Tkinter import * from appJar import gui from os import listdir from os.path import isfile, join import time from find import find print("application started") print("define variables") #define vars app = gui() file_name = "Dicsoites: " mypath= "./songs" #add files to the list listin = [f for f in listdir(mypath) if isfile(join(mypath, f))] listout = [] #define vars end #functions start here def listnav(btn): print("button \""+btn+"\" pressed") if(btn == ">"):
def initDraw(): paramdict=pickle.load(open( paramsaveDirf, "rb" )) centerHU=paramdict['centerHU'] limitHU=paramdict['limitHU'] global app app = gui("ROI form"+version,"1000x500") # app.setStopFunction(Stop) if not goodir: selectPatientDir() if goodir: app.addLabel("path_patientt", "path_patient",colspan=2) app.addLabel("path_patient", lisdir,colspan=2) app.setLabelBg("path_patient", "Blue") app.setLabelFg("path_patient", "Yellow") app.setLabelBg("path_patientt", "Blue") app.setLabelFg("path_patientt", "Yellow") app.addLabel("top", "Select patient ID:") app.setLabelBg("top", "Grey") app.setLabelFg("top", "Blue") row = app.getRow() app.addButton("HELP", presshelp,row,1) some_sg,stsdir=lisdirprocess(lisdir) listannotated=[] for user in some_sg: if len(stsdir[user])>0: lroi='' for r in stsdir[user]: lroi=lroi+' '+r listannotated.append(user+' ROI!: '+lroi) else: listannotated.append(user+' noROI! ') app.addListBox("list",listannotated,row,0) app.setListBoxRows("list",10) row = app.getRow() # app.addHorizontalSeparator( row,1,colour="Red") # row = app.getRow() app.addLabelNumericEntry("centerHU",row,1) app.setEntry("centerHU",centerHU) row = app.getRow() app.addLabelNumericEntry("limitHU",row,1) app.setEntry("limitHU", limitHU) row = app.getRow() app.addHorizontalSeparator( row,colour="red",colspan=2) row = app.getRow() app.addLabel("ForceGenerate","Tick to force re-generate all files:",row,0) app.addCheckBox("ForceGenerate",row,1) app.setCheckBox("ForceGenerate",ticked=False,callFunction=False) # app.addCheckBox("ImageTreatment",row,2) # app.setCheckBox("ImageTreatment",ticked=False,callFunction=False) row = app.getRow() app.addHorizontalSeparator( row,colour="red",colspan=2) row = app.getRow() app.addButton("Generate ROI", press,row,1) row = app.getRow() app.addButton("Generate Lung_Mask", presslung,row,1) row = app.getRow() app.addButton("check volume", checkvolume,row,1) # app.addHorizontalSeparator( colour="red",colspan=2) app.addButton("Quit", boutonStop,row,0) app.go() sys.exit(1)