1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
emmainna [20.7K]
2 years ago
10

Write a GUI-based program that allows the user to open, edit, and save text files. The GUI should include a labeled entry field

for the filename and multi-line text widget for the text of the file. The user should be able to scroll through the text by manipulating a vertical scrollbar. Include command buttons labeled Open, Save, and New that allow the user to open, save and create new files. The New command should then clear the text widget and the entry widget.
Computers and Technology
1 answer:
Korvikt [17]2 years ago
6 0

to create a simple notepad in Python using Tkinter. This notepad GUI will consist of various menu like file and edit, using which all functionalities like saving the file, opening a file, editing, cut and paste can be done.

Now for creating this notepad, Python 3 and Tkinter should already be installed in your system. You can download suitable python package as per system requirement. After you have successfully installed python you need to install Tkinter (a Python’s GUI package).

Use this command to install Tkinter :

pip install python-tk

Importing Tkinter :

filter_none

edit

play_arrow

brightness_4

import tkinter  

import os  

from tkinter import *

 

# To get the space above for message  

from tkinter.messagebox import *

 

# To get the dialog box to open when required  

from tkinter.filedialog import *

Note : messagebox is used to write the message in the white box called notepad and filedialog is used for the dialog box to appear when you are opening file from anywhere in your system or saving your file in a particular position or place.

 

Adding Menu :

filter_none

edit

play_arrow

brightness_4

# Add controls(widget)  

 

self.__thisTextArea.grid(sticky = N + E + S + W)  

 

# To open new file  

self.__thisFileMenu.add_command(label = "New",  

                               command = self.__newFile)  

 

# To open a already existing file  

self.__thisFileMenu.add_command(label = "Open",  

                               command = self.__openFile)  

 

# To save current file  

self.__thisFileMenu.add_command(label = "Save",  

                               command = self.__saveFile)  

 

# To create a line in the dialog  

self.__thisFileMenu.add_separator()  

 

# To terminate  

self.__thisFileMenu.add_command(label = "Exit",  

                               command = self.__quitApplication)  

self.__thisMenuBar.add_cascade(label = "File",  

                              menu = self.__thisFileMenu)  

 

# To give a feature of cut  

self.__thisEditMenu.add_command(label = "Cut",  

                               command = self.__cut)  

 

# To give a feature of copy  

self.__thisEditMenu.add_command(label = "Copy",  

                               command = self.__copy)  

 

# To give a feature of paste  

self.__thisEditMenu.add_command(label = "Paste",  

                               command = self.__paste)  

 

# To give a feature of editing  

self.__thisMenuBar.add_cascade(label = "Edit",  

                              menu = self.__thisEditMenu)  

 

# To create a feature of description of the notepad  

self.__thisHelpMenu.add_command(label = "About Notepad",  

                               command = self.__showAbout)  

self.__thisMenuBar.add_cascade(label = "Help",  

                              menu = self.__thisHelpMenu)  

 

self.__root.config(menu = self.__thisMenuBar)  

 

self.__thisScrollBar.pack(side = RIGHT, fill = Y)  

 

# Scrollbar will adjust automatically  

# according to the content  

self.__thisScrollBar.config(command = self.__thisTextArea.yview)  

self.__thisTextArea.config(yscrollcommand = self.__thisScrollBar.set)  

With this code we will add the menu in the windows of our notepad and will add the things like copy, paste, save etc, to it.

Explanation:

You might be interested in
Write a Box class whose init method takes three parameters and uses them to initialize the private length, width and height data
lord [1]

Answer:

Answered below

Explanation:

//Program is written in Java programming //language

Class Box{

private double length;

private double width;

private double height;

Box(double len, double wid, double hgt){

length = len;

width = wid;

height = hgt;

}

public double volumeOfBox( ){

double volume = length * width * height;

return volume;

}

public double getLength( ){

return length;

}

public double getWidth( ){

return width;

}

public double getHeight( ){

return height;

}

}

8 0
2 years ago
Which access method would be most appropriate if your manager gave you a special cable and told you to use it to configure the s
GrogVix [38]
Console Port Method

Connecting a computer to a Cisco device through the console port requires a special console cable.
8 0
2 years ago
The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
Dafna11 [192]
<span>B. Second phase of the Keynesian LRAS Curve.</span>
5 0
3 years ago
What trade-offs do you think engineers make between functionality, safety and aesthetics when building a real bridge?
elena55 [62]
Deciding where it should go
6 0
3 years ago
The ________________ Act requires Internet sales to be treated in the same way as mail-order sales (e.g., collect sales tax from
BARSIC [14]

Answer:

Internet Tax Freedom Act

Explanation:

The Internet Tax Freedom Act was signed into law in 1998 by President Bill Clinton and has since been reviewed until the Permanent Internet Tax Freedom Act was passed into law on the 9th of June, 2015 by President Barrack Obama.

The Act requires that internet sales are equally treated as mail-order sales.

5 0
2 years ago
Other questions:
  • Which column and row references are updated when you copy the formula: =F$5+12? Value 12 Column F Column F and row 5 Row 5
    8·1 answer
  • The business case for using grid computing involves all of the following except: speed of computation. cost savings. agility. in
    5·1 answer
  • You have just installed a SOHO router in a customer’s home and the owner has called you saying his son is complaining that Inter
    9·1 answer
  • What should you do to organize a large amount of data??
    10·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • Audiovisual means that a presentation combines film and photos.<br> true or false?
    6·2 answers
  • Which statement describes how to insert the IF, COUNTIF, or SUM function into a cell?
    11·1 answer
  • PLEASE HELP <br> Which of the following best describes the existence of undecidable problems?
    7·1 answer
  • Consider the following correct implementation of the selection sort algorithm.
    5·1 answer
  • How it/computing has impacted on engineering? <br><br> I need seven answers please help !
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!