CSSG-Labs / PyNote

Text Editor Written in Python
GNU General Public License v3.0
3 stars 4 forks source link

Create "New" function #14

Closed PatrickBruso closed 2 years ago

PatrickBruso commented 2 years ago

We need to create a new function within our Application class that can be linked to the "New" labeled command. This function will operate similar to the saveas function, and should allow the user to create a new, blank text window. If the current window contains any text, the user should first be prompted to save the text. If the user decides to save the text, it should call the "Save" function. Otherwise, if the user does not want to save the text, the text should be deleted.

NOTE: this issue should not be completed until the "Save" function has been created, as it will call that function. The plan is to have the "Save" function determine whether the user needs to "Save" or "Save as" (that is, whether the file has previously been saved or not).

glunkad commented 2 years ago

Hey @PatrickBruso , I'm interested in contributing to this issue, so before I start working it, would you mind sparing your time explaining what the issue is about and pointing me to some resources to get started.

PatrickBruso commented 2 years ago

@9gl Sure, you need to connect the filemenu command for "New" on line 14 of main.py to a function that you will write. That function should be named "new" and passed in the "self" parameter (see for example the saveas function on line 27).

The function you write should get the text from self.text (see line 21) and then delete the text, so that the text box is empty. See this stackoverflow thread for an example of how to delete text from a text box.