Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python tkinter GUI Review on pack, pack_forget, grid, grid_forget, and grid_remove: You can call pack forget to remove a widget (if you use pack to

python tkinter GUI image text in transcribed
image text in transcribed
Review on pack, pack_forget, grid, grid_forget, and grid_remove: You can call pack forget to remove a widget (if you use pack to add it to the window). Example: import tkinter as tk root = tk. Tk() b= tk. Button(root, text="Delete me", command=lambda: b.pack forget()) b.pack() rootimainloop() If you use pack forget, you can later show the widget again calling pack again. If you want to permanently delete it, call destroy on the widget (then you won't be able to re-add it). If you use the grid method, you can use grid_forget or grid_remove to hide the widget. Tips for solving the problem described below: Consider defining a class for each of the media players (i.e., editor, image viewer, etc.), and use frames to manage more than one widget as a group. When you specify the path to a resource file such as an image or sound clip, do not use abaolute path. Problem (70 points): Learn about the fundamentals of tkinter widgets and GUI app 1. Create a Python project in Eclipse with a name like FirstName-LastName-ex1 (e.g, Jane-Does ex1). 2. Add five packages to the sre folder of the project, as weil as an ordinary file system folder, not a package, named data to the sre folder of the project. Detalls follow. a. First package named texteditor - This package has a module named editor.py for creating a simple text editor. Use thinter.scrolledtext module for the editor. The editor must support saving the content of the editor as a text file. It must be saved as a text file in the data folder. The editor must also support closing the editor, not the root window, including the two buttons. See the Figure 1 above. Note: Although no shown, adding another button named Quit to the root window would be great in addition to the four buttons (I.e., Editor, Image Viewer, Audio Player, and Video Player). b. Second package named limagevlewer - This package has a module named image_viewer.py to allow the user to view an image stored in the data folder. Like the editor, the image viewer must have two buttons: View and Close. Clicking the View button shows an image stored in the data folder. Clicking the Close button removes the viewer and the two buttons from the root window. c. Third package named audioplayer - This package has a module named audio _player.py to allow the user to play an audio clip stored in the data folder. Like the image_viewer, the audio player must have five buttons: Start, Pause, Resume, Stop, and Close. Clicking the Start button shows an audio clip stored in the data folder, and so on. Clicking the Close button removes the palyer and the two buttons from the root window. d. Fourth package named videoplayer - This package has a module named video player.py to allow the user to play a video clip stored in the data folder. Like the audio_player, the video player must have two buttons: Play and Close. Clicking the Play button shows an audio clip stored in the data folder. Clicking the Close button removes the palyer and the two buttons from the root window. e. Fifth package named multimedia - This package has a module naned launcher.py to provide an interface to the application with four buttons. See the image below. As you know, the launcher module should import all the modules you have created. Aforementioned, adding another button named Quit to the root window would be great. 3. Test your app before submission. a. Export your project to a zip file (See the Canvas course site for how-to-export). b. Create a test project in Eclipse and import the zip file to the project (See the Canvas course site for how-to-import). c. Run your app to see if it runs flawlessly. 4. Submit the zip file on Canvas. Review on pack, pack_forget, grid, grid_forget, and grid_remove: You can call pack forget to remove a widget (if you use pack to add it to the window). Example: import tkinter as tk root = tk. Tk() b= tk. Button(root, text="Delete me", command=lambda: b.pack forget()) b.pack() rootimainloop() If you use pack forget, you can later show the widget again calling pack again. If you want to permanently delete it, call destroy on the widget (then you won't be able to re-add it). If you use the grid method, you can use grid_forget or grid_remove to hide the widget. Tips for solving the problem described below: Consider defining a class for each of the media players (i.e., editor, image viewer, etc.), and use frames to manage more than one widget as a group. When you specify the path to a resource file such as an image or sound clip, do not use abaolute path. Problem (70 points): Learn about the fundamentals of tkinter widgets and GUI app 1. Create a Python project in Eclipse with a name like FirstName-LastName-ex1 (e.g, Jane-Does ex1). 2. Add five packages to the sre folder of the project, as weil as an ordinary file system folder, not a package, named data to the sre folder of the project. Detalls follow. a. First package named texteditor - This package has a module named editor.py for creating a simple text editor. Use thinter.scrolledtext module for the editor. The editor must support saving the content of the editor as a text file. It must be saved as a text file in the data folder. The editor must also support closing the editor, not the root window, including the two buttons. See the Figure 1 above. Note: Although no shown, adding another button named Quit to the root window would be great in addition to the four buttons (I.e., Editor, Image Viewer, Audio Player, and Video Player). b. Second package named limagevlewer - This package has a module named image_viewer.py to allow the user to view an image stored in the data folder. Like the editor, the image viewer must have two buttons: View and Close. Clicking the View button shows an image stored in the data folder. Clicking the Close button removes the viewer and the two buttons from the root window. c. Third package named audioplayer - This package has a module named audio _player.py to allow the user to play an audio clip stored in the data folder. Like the image_viewer, the audio player must have five buttons: Start, Pause, Resume, Stop, and Close. Clicking the Start button shows an audio clip stored in the data folder, and so on. Clicking the Close button removes the palyer and the two buttons from the root window. d. Fourth package named videoplayer - This package has a module named video player.py to allow the user to play a video clip stored in the data folder. Like the audio_player, the video player must have two buttons: Play and Close. Clicking the Play button shows an audio clip stored in the data folder. Clicking the Close button removes the palyer and the two buttons from the root window. e. Fifth package named multimedia - This package has a module naned launcher.py to provide an interface to the application with four buttons. See the image below. As you know, the launcher module should import all the modules you have created. Aforementioned, adding another button named Quit to the root window would be great. 3. Test your app before submission. a. Export your project to a zip file (See the Canvas course site for how-to-export). b. Create a test project in Eclipse and import the zip file to the project (See the Canvas course site for how-to-import). c. Run your app to see if it runs flawlessly. 4. Submit the zip file on Canvas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions