Calling a PyGame Function, from clicking a Object-Orientated PyGame Button

import pygame as pg import sys pg.init() buttonFont = pg.font.SysFont("garamond", 25) screenGray = pg.Color('gray80') buttonGray2 = pg.Color('gray50') textColour = pg.Color('navy') screen = pg.display.set_mode((800, 600)) clock = pg.time.Clock() class Button(pg.sprite.Sprite): def __init__(self, text, x, y, width, height, colour): super().__init__() self.image = pg.Surface((width, height)) self.image.fill(colour) self.rect = self.image.get_rect() txt = buttonFont.render(text, True, textColour) txtRect = txt.get_rect(center = … Read more

Is it possible to make the keyboard module work with pygame and threading

My friend challenged me to make a small program that allows the user to press a button on a Xbox controller and have it do multiple functions on the keyboard (like reWASD). I thought I almost made it to the end and found the having keyboard.press() and keyboard.release() wouldn’t do its function. Is there any possible way to make it do what I hoped it to do. Sorry for the bad English I am freshmen and its 1 am and I am new to stakoverflow formatting.

How to suppress console output in Python?

I’m using Pygame/SDL’s joystick module to get input from a gamepad. Every time I call its get_hat() method it prints to the console. This is problematic since I use the console to help me debug and now it gets flooded with SDL_JoystickGetHat value:0: 60 times every second. Is there a way I can disable this? Either through an option in Pygame/SDL or suppress console output while the function calls? I saw no mention of this in the Pygame documentation.