Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

python

  1. menator01

    Python Pygame pong - part 1 (Getting pygame window up and running)

    In this tutorial we will build a simple pong game with python and pygame. The final result should be simular to the below image Pygame can be installed using pip install pygame or python3 -m pip install pygame Create a python file called pong.py in the text editor of choice. I prefer vscode...
  2. menator01

    Python Pygame pong - part 2 (The paddle)

    In part 2 we will: create the paddle class create allsprites group create the paddle movement import pygame # Create empty list and sprite group players = [] allsprites = pygame.sprite.Group() class Player(pygame.sprite.Sprite): ''' Player class will define our player and player...
  3. menator01

    Python Pygame pong part 3 - (The Ball)

    In part 3 we will be creating the ball class Give the ball a size Give the ball a color Give the ball a random velocity and direction when colliding with the paddles or wall class Ball(pygame.sprite.Sprite): ''' The Ball class creates the ball for our pong table. ''' def...
  4. menator01

    Python Pygame pong part 4 - Scoreboard

    In part 4 we will create a scoreboard placed at the top of the pong table In the while loop add # Draw the scoreboard to screen board = pygame.Surface([window[0], 40]) board.fill((60,60,60)) screen.blit(board, (0,0)) # Add a font font = pygame.font.Font(None, 24)...
  5. menator01

    Python Pygame pong part 5 - (Start Page)

    In the 5th and final part of the tutorial we will create a start page for our pong game. The start page will present some text an image and instructions on how to start the game. # Class creates a start/title page class Page: def title(self): ''' title method creates a start page...
  6. menator01

    Python Introduction to a Simple Tkinter Calculator

    Tkinter Calculator In this tutorial we will build a simple calculator using tkinter and python. Modules needed tkinter tkinter is installed by default with python if it does not come with your version of python, it can be installed by Ubuntu - sudo apt install python3-tk MacOS - brew install...
  7. menator01

    Python Simple Tkinter Calculator Part 1 - Tkinter Window

    In this tutorial we will get our tkinter window running and define our 2 classes import tkinter as tk from decimal import Decimal class Window: def __init__(self, parent): self.parent = parent ''' We will be using the grid manager ''' parent.columnconfigure(0...
  8. menator01

    Python Simple Tkinter Calculator Part 2 - (Building the window display)

    In part 2 of our project, we will be building the window graphics for the calculator. We will: Create a container to hold all the widgets Create a entry field that will display the numbers, symbols, and results of calculations Create a list of numbers and symbols used Create an empty list to...
  9. menator01

    Python Simple Tkinter Calculator Part 3 (Build methods and bind buttons)

    Simple Tkinter Calculator Part 3 In part3 we will: Create methods in our Controller class Bind the buttons to the methods Create a simple validation Create methods def valid_input(self,arg): ''' Method for validating input ''' if arg.isalpha() or arg == '='...
  10. menator01

    Python Simple Tkinter Calculator - Full Code

    Here is the full working code # Do the imports import tkinter as tk from decimal import Decimal class Window: def __init__(self, parent): self.parent = parent ''' We will be using the grid manager ''' parent.columnconfigure(0, weight=1) parent.rowconfigure(0...
  11. menator01

    Python Simple pygame dodge car game - Introduction

    In this tutorial, we will make a simple pygame dodge car game. Requirements: python 3.12 Note: python 3.10 and 3.11 will probably work. pygame 2.5.2 Images I used images from opengameart specific images are pixel-race-car-pack Editor of choice. I use vscode The game should look something like...
  12. menator01

    Python Simple pygame dodge car game - pygame window

    The directory structure I'm using: car media images cars car.py car being the main folder, media to hold all the media types folders, images, and then the folder holding car images car.py should be something like: # Do the imports import pygame import os ''' Get the path of the...
  13. menator01

    Python Simple pygame dodge car game - The Road

    In this tutorial we will be creating the road. Although there are several ways of doing this, I created three functions. One function for the blacktop part, one for the 2 yellow lines, and one for the white dotted line # define a function to draw the yellow lines def line(surf, x): line =...
  14. menator01

    Python Simple pygame dodge car game - Player and Mobs

    In this tutorial we will be creating a classes for the player and mob cars In the cars images I downloaded, I took and edited the images with gimp as the has space around them that was causing the mob cars to hit the player car at a distance. I just used crop to shrink/remove the spaces. I've...
  15. menator01

    Python Simple pygame dodge car game - sprite collisions

    In this part of the tutorial we will be adding sprite collision detection In the game loop, I put it right under the update and draw ''' Mob has moved off the screen kill the sprite. Create a new mob. ''' if mob.rect.top > 720: # Screen height mob.kill()...
  16. menator01

    Python Simple pygame dodge car game - Scoring and start page

    In this final part of the tutorial we will implement a scoring system and start page Scoring: Create a function for displaying text Player class add attribute for keeping the score total Blit the score to the screen function for displaying text def score(score): # Create a font and size...
  17. menator01

    Python PyQt5 - Python 3.12 Music Player - Introduction

    In this tutorial we will be creating a music player using PyQt5 and Python 3.12 Requirements: PyQt5 Python 3.12 Mutagen What the app will do is allow us to browse for music (mp3) files, add them to a playlist, use a next/prev buttons, and have a volume knob. Although this image was written...
  18. roberrtt

    Could Someone Give me Advice for Building a Simple To-Do List App in Python?

    Hello there, I am new to Python and coding in general, and I’m working on a small project to practice what I have learned so far. My goal is to create a simple command line to-do list app that can perform basic tasks like adding; removing; and viewing tasks. Users can input a task, and it will...
  19. blnkoff

    Sensei: Simplifying API Client Generation

    What My Project Does Sensei simplifies the process of creating API Clients by handling routing, data validation, and response mapping automatically. This reduces the complexity of HTTP requests, making it easier to integrate APIs into your projects without writing boilerplate code. Sensei uses...
  20. B

    Python Python ADT scoring

    Would any of you be able help with this ADT python question: https://dpaste.org/wNuDK
Back
Top Bottom