Pierwsze próby poznania pygame.
This commit is contained in:
commit
93d4b3018a
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
.idea/Sztuczna_Inteligencja_Gr16.iml
Normal file
10
.idea/Sztuczna_Inteligencja_Gr16.iml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (Sztuczna_Inteligencja_Gr16)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (Sztuczna_Inteligencja_Gr16)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Sztuczna_Inteligencja_Gr16.iml" filepath="$PROJECT_DIR$/.idea/Sztuczna_Inteligencja_Gr16.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
Ikony/test1_ikona.png
Normal file
BIN
Ikony/test1_ikona.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
Ikony/traktor_ikona.png
Normal file
BIN
Ikony/traktor_ikona.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
36
main.py
Normal file
36
main.py
Normal file
@ -0,0 +1,36 @@
|
||||
import os
|
||||
|
||||
import pygame
|
||||
|
||||
FPS = 60
|
||||
SZEROKOSC_OKNA = 800
|
||||
WYSOKOSC_OKNA = 600
|
||||
BIALY = (255, 255, 255)
|
||||
|
||||
OKNO = pygame.display.set_mode((SZEROKOSC_OKNA, WYSOKOSC_OKNA))
|
||||
pygame.display.set_caption("Okno1")
|
||||
|
||||
TEST1_IKONA = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'test1_ikona.png')), (500, 500))
|
||||
TRAKTOR_IKONA = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'traktor_ikona.png')), (100, 100))
|
||||
|
||||
|
||||
def wyswietl_okno():
|
||||
OKNO.fill(BIALY)
|
||||
OKNO.blit(TEST1_IKONA,
|
||||
(SZEROKOSC_OKNA / 2 - TEST1_IKONA.get_width() / 2, WYSOKOSC_OKNA / 2 - TEST1_IKONA.get_height() / 2))
|
||||
OKNO.blit(TRAKTOR_IKONA, (0, 0))
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
klatkaz = pygame.time.Clock()
|
||||
warunek_dzialania = True
|
||||
while warunek_dzialania:
|
||||
klatkaz.tick(FPS)
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
warunek_dzialania = False
|
||||
break
|
||||
|
||||
wyswietl_okno()
|
||||
|
||||
pygame.quit()
|
Loading…
Reference in New Issue
Block a user