Jump to content

Eric 6 User's Guide/Getting Started/Quick Start

From Wikibooks, open books for an open world

Hello World

[edit | edit source]

When Eric starts, the editor window (Central Park) is blank, watermarked with the Eric logo.

If you just want to bang in some code, select File, New. The blank tab will become labeled Untitled 1 and the editor window will take on a black background. Typing yields white text. This is to remind you that the contents have not been saved. Saving the file ("hellowworld.py") will switch to black text on white.

As you add new lines, note that the left line margin is red - unsaved - while the previously saved lines have green markers. This is just one of Eric's myriad of UI cues (there should be a prize for the person who spots and documents the most).

Create a demo:

#!/usr/bin/python3
"""
Hello World
"""
def main():
    # demo
    print("Hello World")
    a = 1 + 1
    print("a = " + str(a))
    
if __name__ == "__main__":
    main()

To test it, click Start, Debug Script (F5). Uncheck "Do not stop at first line". Click Okay. The display will change - worth looking around. The Debug menu choices will be enabled: F7 to step, etc

Unless you are dipping just the very end of your baby toe in the pool, you'll want to go further. Recommended next step: create a project.

New Project

[edit | edit source]

Menu Project, New: wants the location of main.py. Hopefully you've got previous Python code organized somewhere? Create a new sub-folder (using Eric's File-Viewer - Left panel - or your favourite file manager). Rename/move the helloworld.py file, above, to main.py in the new folder. Back to Project, New. The fields on the form that appears are pretty much self-explanatory. Fill in a Project Name, select the new folder for Project Directory and main.py for the Main Script and make whatever other changes/additions you prefer.


Eric will create a project file in the folder named ProjectName.epj and add an __init__.py file. The Project Viewer (Left), will list the __init_.py and main.py files. Click on main.py - it opens in the editor window.


.