一個學校電腦轉家裡電腦的中轉站。

秋風莊莊主悠發表於2021-04-15

1,pygame

import sys import pygame

class firstgame: def init(self): pygame.init() self.screen = pygame.display.set_mode((1200, 800)) pygame.display.set_caption("firstgame") self.bg_color=(230,230,230) self.settings=settings() self.screen=pygame.display.set_mode((self.settings.screen_width,self.settings.screen_height))

def run_game(self):
    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        self.screen.fill(self.bg_color)

        pygame.display.flip()

class settings(): def init(self): self.screen_width=1200 self.screen_height=800 self.bg_color=(230,230,230)

if name == 'main': ai = firstgame() ai.run_game()strong text

test: class jack(): def init(self,age,friend): self.a=age self.b=friend def prints(self): print(self.a,"is a people s age,and he has ",self.b) def growth(self,years): self.a+=years

a=jack(454,"joes") a.growth(23) a.prints() a=jack("fadssa","edfws00") a.prints()

import unittest from tuetle import jack as tests

a = tests(454, "joes") a.growth(23) a.prints() a = tests("fadssa", "edfws00") a.prints()

class test_class(): def test

相關文章