i have two py files. her they are:
the button file obviously does not know what i am talking about when i tell it to draw a rectangle to screen, because screen is defined elsewhere. i have no idea how to fix this, it seems like i am not allowed to have any other classes if i am using a screen, which i desperately hope is not correct. Please help me figure this out, powers that be, before i put my head through a wall.
1 2 3 4 5 6 7 8 9 10 |
import pygame class button: def __init__( self ): pygame.draw.rect(screen, 10 , 10 , 10 , 10 ) print ( "fuckyouuuu" ) def __call__( self ): print ( "FHDFDEDEDDDFDFDF" ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import Button import pygame import sys from pygame. locals import * x = 0 y = 30 import os os.environ[ 'SDL_VIDEO_WINDOW_POS' ] = "%d,%d" % (x,y) pygame.init() infoObject = pygame.display.Info() correctedscreenheight = (infoObject.current_h - 30 ) screen = pygame.display.set_mode((infoObject.current_w, correctedscreenheight)) pygame.display.set_caption( 'Dnd reimagined' ) mainscreen = pygame.image.load( "dnd.png" ).convert() WHITE = ( 25 , 25 , 25 ) fuckoff = Button.button() while True : for event in pygame.event.get(): if event. type = = QUIT: pygame.quit() mainscreen = pygame.transform.scale(mainscreen, (infoObject.current_w, infoObject.current_h)) screen.blit(mainscreen, ( 0 , 0 )) pygame.display.update() |