GUI creation in python using tkinter part 1

Overview

When executing a tool made with python, there is no problem if you call it from the command line if you made it yourself, but if it is a tool used by people who are not related to development, it is better to be able to operate it from the screen It's convenient. I researched various things to see if I could make an application with python and summarized the contents I made. It's still not very well made, so I plan to adjust it gradually.

Things necessary

Publication place

It is published on github. https://github.com/snowpff14/etcresource/tree/master/pythonGui

Processing content

Script for operating selenium practice site see here, script for adding columns and deleting rows in Excel file [see here](https: // qiita.com/snowp/items/94f8bb06a08e42af6bba) can now be started.


    inputFolder=StringVar()
    outputFolder=StringVar()

    def openFile(self):
        fTyp = [('','*.xlsx')]
        iDir = os.path.abspath(os.path.dirname(__file__))
        filename = filedialog.askopenfilename(filetypes = fTyp,initialdir = iDir)
        return filename

    def fileButton(self):
       filename= self.openFile()
       self.inputFileName.set(filename)

    def doExecute(self):
        # threading.Lock
        thread=threading.Thread(target=self.execute)
        thread.start()

    def execute(self):

        excelFile=pd.ExcelFile(self.inputFileName.get())
        reserveSheetTemp=excelFile.parse(sheet_name='Reservation sheet',dtype='str',header=1)
        print(reserveSheetTemp.head())
        log=LoggerObj()
        driver=webdriver.Chrome('C:/webdrivers/chromedriver.exe')
        driver.get('http://example.selenium.jp/reserveApp/')

        reserveSheet=reserveSheetTemp.query('Invalid flag!= "1"')
        testSideOrder=TestSiteOrder(driver,log,'test')
        #Enter working hours
        testSideOrder.inputOrder(reserveSheet)

        testSideOrder.createOkDialog('Processing completed','登録Processing completed')

root= tkinter.Tk()

    def main(self):
        root.title("Python GUI")
        content = ttk.Frame(root)
        frame = ttk.Frame(content,  relief="sunken", width=400, height=500)
        content.grid(column=0, row=0)

        title.grid(column=0, row=0, columnspan=4)

        fileLabel=ttk.Label(content,text="Reservation information")
        resultFolderLabel=ttk.Label(content,text="Folder specification")

        fileInput=ttk.Entry(content,textvariable=self.inputFileName,width=70)
        resultFolderInput=ttk.Entry(content,textvariable=self.outputFolder,width=70)

        self.progressMsgBox=ttk.Label(content,textvariable=self.progressMsg,width=70)

        self.progressBar=ttk.Progressbar(content,orient=HORIZONTAL,length=140,mode='indeterminate')
        self.progressBar.configure(maximum=10,value=0)

        fileInputButton=ttk.Button(content, text=BUTTON_LABEL_REFERENCE,command=self.fileButton)
        resultDirectoryInputButton=ttk.Button(content, text=BUTTON_LABEL_REFERENCE,command=self.inputResultFolderButton)
         
        executeButton=ttk.Button(content,text='Run',command=self.doExecute)
        fileExecuteButton1=ttk.Button(content,text='File operation Insert execution',command=self.fileInsert)
        fileExecuteButton2=ttk.Button(content,text='File operation delete execution',command=self.fileDelete)
        root.mainloop()

When you start it, the following screen will be displayed.

image.png

For the time being, this time around Continued created

Recommended Posts

GUI creation in python using tkinter part 1
GUI creation in python using tkinter 2
GUI programming in Python using Appjar
Create a python GUI using tkinter
About building GUI using TKinter of Python
[GUI in Python] PyQt5-Dialog-
Basics of I / O screen using tkinter in python3
[GUI in Python] PyQt5 -Widget-
UI Automation Part 2 in Python
Introducing GUI: PyQt5 in Python
[GUI in Python] PyQt5 -Event-
Translate using googletrans in Python
Using Python mode in Processing
Try to make it using GUI and PyQt in Python
[Python GUI] DICOM contrast adjustment and BMP conversion using Tkinter
I tried to make a stopwatch using tkinter in python
Transpose CSV files in Python Part 1
[Python] Show multiple windows in Tkinter
Precautions when using pit in Python
Linebot creation & file sharing in Python
Try using LevelDB in Python (plyvel)
Using global variables in python functions
Let's see using input in python
Infinite product in Python (using functools)
Edit videos in Python using MoviePy
Excel graph creation using python xlwings
[GUI in Python] PyQt5-Menu and Toolbar-
Handwriting recognition using KNN in Python
Try using Leap Motion in Python
Depth-first search using stack in Python
When using regular expressions in Python
Basic Linear Algebra Learned in Python (Part 1)
Mouse operation using Windows API in Python
Try using the Wunderlist API in Python
Periodic execution processing when using tkinter [Python3]
AM modulation and demodulation in Python Part 2
Get Suica balance in Python (using libpafe)
(Bad) practice of using this in Python
Slowly hash passwords using bcrypt in Python
Try using the Kraken API in Python
Using venv in Windows + Docker environment [Python]
Create a simple GUI app in Python
[FX] Hit oanda-API in Python using Docker
Tweet using the Twitter API in Python
[Python] [Windows] Serial communication in Python using DLL
Draw a heart in Python Part 2 (SymPy)
I tried using Bayesian Optimization in Python
GUI programming using kivy ~ Part 6 Various layouts ~
Log in to Slack using requests in Python
Get Youtube data in Python using Youtube Data API
Using physical constants in Python scipy.constants ~ constants e ~
Scraping a website using JavaScript in Python
Develop slack bot in python using chat.postMessage
Tkinter could not be imported in Python
Write python modules in fortran using f2py
Draw a tree in Python 3 using graphviz
GUI programming using kivy ~ Part 2 Progress bar ~
Notes for using python (pydev) in eclipse
Disease classification in Random Forest using Python
Download files in any format using Python
Parallel task execution using concurrent.futures in Python