Skip to content

Instantly share code, notes, and snippets.

View horstjens's full-sized avatar
💭
teaching python/pygame to children

Horst JENS horstjens

💭
teaching python/pygame to children
View GitHub Profile
@horstjens
horstjens / tipptrainer_sighan.py
Created May 20, 2023 14:52
pysimplegui tipptrainer german
import random
import time
import PySimpleGUI as sg
with open("german.txt") as myfile:
wörter = [wort.strip() for wort in myfile.readlines()]
#print(wörter)
layout = [
[sg.Text("mein Wort:"), sg.Text("abc", key="text1",
@horstjens
horstjens / 15_python_tips.md
Created May 11, 2023 09:11 — forked from Julynx/15_python_tips.md
15 Python Tips To Take Your Code To The Next Level!
@horstjens
horstjens / nicerock.py
Created April 17, 2023 14:07
nicegui test rock-paper-scissors
from nicegui import ui, app
from nicegui.events import ClickEventArguments
import random
app.add_static_files('/images', 'images' )
lookup = {
"Scissors": {
"Scissors": "It's a draw.",
"Rock": "Rock ruins scissors. You lose.",
@horstjens
horstjens / cannon_vpython.py
Created April 7, 2023 08:35
cannon vpython
import vpython as vp
xarrow = vp.arrow(pos=vp.vector(0,0,0), axis=vp.vector(1,0,0), color=vp.vector(1,0,0))
yarrow = vp.arrow(pos=vp.vector(0,0,0), axis=vp.vector(0,1,0), color=vp.vector(0,1,0))
zarrow = vp.arrow(pos=vp.vector(0,0,0), axis=vp.vector(0,0,1), color=vp.vector(0,0,1))
barrel1 = vp.cylinder(pos=vp.vector(-1,1,0), radius=0.25, axis=vp.vector(3,0,0), color=vp.vector(0.6,0.6,0.6))
@horstjens
horstjens / doppeldecker.py
Created April 7, 2023 08:20
doppeldecker vpython
# requriements:
# sudo pip3 install vpython
# sudo pip3 install pygame
import vpython as v
import random
import pygame
#except ModuleNotFoundError:
# print("I could not import pygame - joystick support is disabled. Try to (re)install pygame")
# Animation für jeden Würfel
import random
import PySimpleGUI as sg
animation_ende = {"w1":0,
"w2":0,
"w3":0,
"w4":0,
"w5":0,
@horstjens
horstjens / turtlerace2.py
Created March 21, 2023 17:24
turtle race
import turtle
import random
screen = turtle.getscreen()
screen.setup(width=1.0, height=0.9, startx=0, starty=0)
width = 1000
height = 500
screen.setworldcoordinates(0,0,width, height)
@horstjens
horstjens / cannon_turtle3.py
Last active March 14, 2023 16:15
cannon game using turtle graphic
import turtle
import math
import random
screen = turtle.getscreen()
screen.setup(width=1.0, height=0.9, startx=0, starty=0)
#width, height = screen.window_width(), screen.window_height()
width = random.randint(20000,50000)
height = width
screen.setworldcoordinates(0,0,width, height)
class Game:
"""containers for everything"""
monsters = {}
#items = {}
locations = {}
player = None
current_room = None
class Location:
import PySimpleGUI as sg
import random
#sg.theme("Material1")
#sg.theme_element_background_color(color = "#000000")
#sg.theme_background_color(color="#FFFFFF")
#sg.theme_button_color(color="#FFFFFF")
class Game: