Development of Python GUI-based File Format Converter

Veröffentlicht am: 30 Mai 2021
auf dem Kanal: ivinamri
1,475
13

SBEG 1483 (Programming II)
Assignment #04 Walk-through

Development of Python GUI-based File Format Converter

Chapters:
0:00 Intro
0:04 Step 1: Data and workspace preparation
0:26 Extract data and verify file structure
0:49 Using your preferable Python IDE or code editor, start to construct the Python code
1:40 Save the file in the workspace folder
2:11 Copy a line sample of the input data
2:45 Define the desired output structure formatting
3:35 Import some Python libraries for the task
5:48 Test the Python code from command prompt. Press Shift-key and Right-click mouse, then select Open command window here
5:55 Execute the Python code. If there is no error, no error message will be shown.
6:23 Prepare the Python module if _name_ == "__main__":
6:53 Call the function processData()
7:11 Create a Python function called processData()
7:49 Define a variable for the input text file
8:46 Define an output filename (in *.csv format)
9:53 Open the input file and read its structure line by line
11:11 Close the opened file event
11:36 Test the code by printing the contents of the text file
12:57 Prepare an output file with writing capabilities
14:09 Manipulate the file to acquire the required values
17:15 Write to CSV format
18:39 Test and verify the output formatting
21:36 Display the number of lines processed from the text file
23:20 Step 2: Import the Tkinter GUI framework module
23:53 Define variable root to initialize the window manager with the tkinter.Tk() method
24:28 Create a canvas widget for drawing shapes (e.g. buttons, labels) later in the GUI
25:33 Add the pack() class to the canvas for geometry management and to display the widget in the defined size
25:06 Use the mainloop() method to display the window until you manually close it. It runs an infinite loop in the backend
27:40 Add title to the GUI window
29:10 Center the GUI window (center screen)
30:40 Add a label for the main header title
32:04 Create window location for displaying the label within the canvas
33:58 Configure some label styling
38:07 Add a button for file browse and selection to the canvas
40:39 Define button styling (background, foreground and font styling)
42:58 Add another button for file processing and saving to the canvas
45:24 Disabling window resizing
48:41 Add an exit button
50:36 Binding a command for the exit button to an exitApplication() function
52:23 Bind command for browse button
56:44 Import Tkinter filedialog module
58:18 Add logic to the file browsing and selection event
1:00:46 Add a status bar to the canvas
1:05:38 Set the default value (empty text) to the display text
1:06:05 Assign the display text value from the file location
1:08:35 Set a global variable for the file location to be used in file processing
1:09:01 Define the file location to None if no file was selected
1:10:00 Create a function to process the text file and convert it to CSV
1:21:23 Preparing the processData() function for file input and output
1:23:46 Verify the CSV output file structure
1:24:31 Display the status of file processing to the status bar
1:26:17 Display a message box upon successful event
1:30:27 Add some logic to the application workflow to handle unsupported input file format
1:34:27 Add logic to exit button
1:42:48 Import Python win32gui (pywin32) for manipulating Python output console
1:44:05 Step 3: Prepare a setup file for building the Python code to a Windows executable file (*.exe). This setup file is required to be used together with py2exe
1:47:34 Define the Python source file to be build as an executable
1:48:10 Run the command python setup.py py2exe to build the distribution files
1:48:47 Verify that a dist folder was created and test the executable file (*.exe)
1:50:56 Assign an icon to the executable file
1:52:22 Find an appropriate icon and convert it to *.ico format
1:55:55 Rebuild the distribution
1:57:06 Assign the generated icon to the GUI window
1:58:41 Hide the Python console upon running the executable file
2:09:23 Copy and paste the generated icon file into the distribution folder (together with the *.exe file)


Auf dieser Seite können Sie das Online-Video Development of Python GUI-based File Format Converter mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ivinamri 30 Mai 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,475 Mal angesehen und es wurde von 13 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!