Python Forum
Where can I find a little project example using main.py and other files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Where can I find a little project example using main.py and other files (/thread-4614.html)



Where can I find a little project example using main.py and other files - sylas - Aug-30-2017

Hi all ! 9If you know a game example or whhatever else, using many files, I should be very glad. Thanks

my code here



RE: Where can I find a little project example using main.py and other files - BerlingSwe - Aug-30-2017

There are alot of projects on github, so I' pretty sure you will find plenty there :)


RE: Where can I find a little project example using main.py and other files - metulburr - Aug-30-2017

Here are a couple games i did a few years ago
https://github.com/metulburr/FloodIt
https://github.com/metulburr/pong

i used game.py instead of main.py

You can also find a lot of completed games on pyweek.org and pygame.org


RE: Where can I find a little project example using main.py and other files - sylas - Aug-30-2017

To MetulBurr: My screen 1280x720, so I think I cannot use your first game. Thanks


RE: Where can I find a little project example using main.py and other files - metulburr - Aug-30-2017

the floodit one is (500, 400)

and the pong one is defaulted to (800,600) with option to change
Output:
$ python game.py -h usage: game.py [-h] [-c] [-f] [-d DIFFICULTY] [-s WIDTH HEIGHT] Pong Arguments optional arguments: -h, --help show this help message and exit -c, --clean Remove all .pyc files and __pycache__ directories -f, --fullscreen start program with fullscreen -d DIFFICULTY, --difficulty DIFFICULTY where DIFFICULTY is one of the strings [hard, medium, easy], set AI difficulty, default is medium, -s WIDTH HEIGHT, --size WIDTH HEIGHT set window size to WIDTH HEIGHT, defualt is 800 600
So if you wanted it to be (500,500) you would do python game.py --size 500 500


RE: Where can I find a little project example using main.py and other files - sylas - Aug-31-2017

Please, where can I find pygame?................................................................................................................................... File "/home/sylvain/PycharmProjects/ping/game.py", line 3, in <module>
    import pygame as pg
ImportError: No module named 'pygame'


RE: Where can I find a little project example using main.py and other files - sparkz_alot - Aug-31-2017

You need to install it first. Presuming you are using Linux and Python 3.x use sudo pip3 install pygame . I don't know if you actually need the "sudo" but it won't hurt.
Note: Use this from the command terminal, not from the Python interactive shell.


RE: Where can I find a little project example using main.py and other files - metulburr - Aug-31-2017

If you are already have pygame installed....You need to make sure that PyCharm is invoking the proper python installation that has pygame installed. Or just run game.py from the downloaded directory from the terminal with
python (2.x) or python3 (3.x)
I wrote the code so that either python version will run