Welcome!

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

SignUp Now!

Search results

  1. User8574

    Python How do I remove the background of an image (Pygame)

    I tried using Gimp to make an alpha channel, I tried using convert_alpha(); how do I remove the background of an image on pygame?
  2. User8574

    Python Pygame: screen.fill and screen.blit not working, please help!

    # Modules import pygame, sys # Init / Clock pygame.init() clock = pygame.time.Clock() # Display Setup screen_width = 1920 screen_height = 1080 screen = pygame.display.set_mode((screen_width,screen_height)) pygame.display.set_caption("Coin Collector") # Objects coin =...
  3. User8574

    Python I make a global variable and then it says it isn't defined, wtf? (Python / Pygame)

    def ball_animation(): global player_score player_score = 0 player_score_surf = font.render(str(player_score), False, (10,10,10)) Apparently player score is not defined. Please help! I tried taking it out of the function above it and it still doesn't work.
  4. User8574

    Python 'Function needs at least three arguments' Pygame screen.blit error

    screen.blit(player_score_surf, (200,200)) I get an error that screen.blit requires three arguments. I tried adding centre as the third as the point of which is at 200,200, but that still doesn't work. How do I fix it?
  5. User8574

    Python Pygame text error

    I enter this code but all that appears is a black rectangle. What do I do to make it output the player_score variable in text? font = pygame.font.Font("LEMONMILK-Regular.otf", 30) player_score = 0 player_score_text = font.render(str(player_score), True, pygame.Color("black")...
  6. User8574

    Python How to resize a rectangle in pygame?

    How do I resize the rectangle and the border to look decent; so creating a margin basically? Is it in the rect.draw code or the rectangle variable? restart_button = font.render('Restart', False, "black").convert() restart_rect = restart_button.get_rect(midbottom = (400,220))...
  7. User8574

    Python I'm not sure what this means and if pygame has been installed successfully.

    (Visual Studio) I installed the newest version of pygame but I'm not sure if it was installed properly. Anyone know? Thanks a lot.
  8. User8574

    Python .get doesn't seem to work :/

    digit_mapping = { "1" == "One", "2" == "Two", "3" == "Three", "4" == "Four" } phone = input("Phone: ") output = "" for digits in phone: output = output + digit_mapping.get(digits, "!") + " " print(output) The .get function is shown as an error (btw this is Python...
  9. User8574

    Python Having problems with if statements in python

    This quiz project doesn't work. print("History Quiz") total_score = 0 print() question1 = input("For how many years did WW2 last? - 3, 5, 6 or 8? ") if int(question1) == 6: print("Correct!") else: print("Better luck next time!") print() question2 = input("In what year did Harry...
  10. User8574

    Python Need help with python calculator issue (bug?)

    I typed in this code operator = input("Choose an operator (1 = Add, 2 = Subtract, 3 = Divide, 4 = Multiply) ") first = input("Enter an integer ") second = input("Enter a second integer ") if operator == 1: result = (float(first) + float(second)) elif operator == 2: result =...
Back
Top Bottom