Open a terminal and run the command pip show easygui to check whether easygui has been installed or not.How To Use Python EasyGUI In Eclipse Pydev. In many cases, adding a graphical interface to Python scripts means getting your hands dirty with TKinter or other GUI programming kits. This exercise is usually reserved for users who have already acquired decent Python programming skills, as it requires some serious code wizardry. Thankfully, the EasyGui module allows you to add some GUI goodness to your Python scripts without going through coding rigmarole. Using EasyGui, you can add visual elements with just a few lines of code. The best way to discover EasyGui’s capabilities is to use it to improve an existing Python script. I put it to work on Pygmynote, a simple data managing tool I created for my personal use to keep tabs on my notes, URLs, and to-dos. Although Pygmynote is not all that difficult to use, adding a few input boxes and dialogs would make it even easier to enter and retrieve records.īefore you start tweaking a script, you have to install EasyGui. Download the latest release of the module, unpack the downloaded archive, and move the easygui.py file into the /usr/lib/python2.5/site-packages directory. To import the module into your script, add the from easygui import * line in the beginning of the script. Let’s start from the beginning and replace the simple “Pygmynote is ready. Input_update=enterbox(msg='Enter tags: ', title='Pygmynote', default='', strip=True)Ĭursor.execute ("UPDATE notes SET tags='" + sqlstr + "' WHERE id='" + input_id + "'""") Input_update=enterbox(msg='Enter note: ', title='Pygmynote', default='', strip=True)Ĭursor.execute ("UPDATE notes SET note='" + sqlstr + "' WHERE id='" + input_id + "'""") If boolbox("What do you want to update?", "Pygmynote", ): Input_id=enterbox(msg='Record ID: ', title='Pygmynote', default='', strip=True) The msgbox function takes at least one parameter, the message to display: Pile up!” greeting message with a fancy message box. If errmsg = "": break # no problems found fieldValues = multenterbox(errmsg, title, fieldNames, fieldValues) # make sure that none of the fields was left blank while 1:Įrrmsg = "" for i in range( len(fieldNames)):Įrrmsg = errmsg + ( '"%s" is a required field.' % fieldNames) "Donation Date", "Director", "Reference number of first record", "Accession number of first record "]įieldValues = # we start with blanks for the valuesįieldValues = multenterbox(msg,title, fieldNames) Grade_interventions = # we start with blanks for the values grade_interventions = multenterbox(msg,title, fieldNames) else:Ĭapture_frame_rate = # we start with blanks for the valuesĬapture_frame_rate = choicebox(msg,title, fieldNames)įps_string = 'Captured at %s fps' % capture_frame_rateĬhoices = No_of_emptyfields = 18 if workflow = "Telecine Grade":įieldNames = # Currently unused, but I'll get around to it :[ else: Physdata2=getPhysData(splitup, float(setup), float(setup),( "sessions"))Īdd_to_revtmd( '//revtmd:codingProcessHistory' + str() + '/revtmd:role', 'Host Computer', revtmd_xmlfile)Īdd_to_revtmd( '//revtmd:codingProcessHistory' + str() + '/revtmd:manufacturer', 'Hewlett Packard', revtmd_xmlfile)Īdd_to_revtmd( '//revtmd:codingProcessHistory' + str() + '/revtmd:modelName', 'Z420 Workstation', revtmd_xmlfile)Īdd_to_revtmd( '//revtmd:codingProcessHistory' + str() + '/revtmd:version', 'ABC123', revtmd_xmlfile)Īdd_to_revtmd( '//revtmd:codingProcessHistory' + str() + '/revtmd:serialNumber', 'CZC4310HP8', revtmd_xmlfile) Physdata1=getPhysData(splitup, float(setup), float(setup),( "sessions")) Setup=eg.multenterbox(title= "Analysis settings",msg= "Choose the settings you want for this analysis.",fields=,values=) M2=eg.choicebox(title= "Select measurement 2",msg= "Select which column contains data files corresponding to measurement 2",choices=splitHead) It also allows you to specify the lower and upper limits for the input value.M1=eg.choicebox(title= "Select measurement 1",msg= "Select which column contains data files corresponding to measurement 1",choices=splitHead) Msgbox ("Record has been updated.", "Pygmynote", ok_button="Close")Īs the name suggests, the integerbox function displays an input box where you can enter only numeric values. #print noofemptyfields with open(inmagic_xmlfile, "w+") as fo: Number = 0 #Inmagic lists the first record as number 0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |