Python Forum
Where can I find a little project example using main.py and other files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where can I find a little project example using main.py and other files
#1
Hi all ! 9If you know a game example or whhatever else, using many files, I should be very glad. Thanks

my code here
Reply
#2
There are alot of projects on github, so I' pretty sure you will find plenty there :)
Reply
#3
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
Recommended Tutorials:
Reply
#4
To MetulBurr: My screen 1280x720, so I think I cannot use your first game. Thanks
Reply
#5
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
Recommended Tutorials:
Reply
#6
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'
Reply
#7
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#8
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
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 945 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  Find duplicate files in multiple directories Pavel_47 9 2,932 Dec-27-2022, 04:47 PM
Last Post: deanhystad
  delete all files and subdirectory from a main folder mg24 7 1,531 Oct-28-2022, 07:55 AM
Last Post: ibreeden
  python run all py files from main py file mg24 6 1,250 Oct-12-2022, 04:41 AM
Last Post: mg24
  count every 28 files and find desire files RolanRoll 3 2,020 Dec-12-2021, 04:42 PM
Last Post: Axel_Erfurt
  Have to use Python 2.x to find "yesterday' files tester_V 6 2,772 Sep-19-2021, 12:26 AM
Last Post: tester_V
  find 'yesterdays files' tester_V 8 3,744 Jun-18-2021, 02:10 AM
Last Post: tester_V
  Find and replace in files with regex and Python Melcu54 0 1,825 Jun-03-2021, 09:33 AM
Last Post: Melcu54
  List of error codes to find (and count) in all files in a directory tester_V 8 3,587 Dec-11-2020, 07:07 PM
Last Post: tester_V
  helping PyInstaller To Find files Harshil 0 1,444 Aug-30-2020, 10:16 AM
Last Post: Harshil

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020