80s_germany_sim and We_are_number_one added.

This commit is contained in:
maxneedspats 2022-07-28 08:35:05 -05:00
parent fbc6e4cccb
commit e5107091fc
6 changed files with 78 additions and 3 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (venv)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project> </project>

View file

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.8 (venv)" jdkType="Python SDK" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View file

@ -0,0 +1,36 @@
import tkinter as tk
window = tk.Tk()
window.title('80s Germany Simulator')
# Labels
top_text = tk.Label(text="0 Luftballons", font='Impact')
top_text.pack(side=tk.TOP)
bottom_text = tk.Label(text='', font='Impact')
bottom_text.pack(side=tk.BOTTOM)
# Scale
def scale_used(value):
top_text.config(text=value + ' Luftballons')
my_scale = tk.Scale(from_=0, to=99, command=scale_used, orient=tk.HORIZONTAL, width=10, length=396)
my_scale.pack(pady=5, padx=7)
# Checkbutton
def checkbutton_used():
print(checked_state.get())
if checked_state.get() == 1:
bottom_text.config(text='The Berlin wall has been torn down')
else:
bottom_text.config(text='The Berlin wall is still standing')
checked_state = tk.IntVar()
my_checkbutton = tk.Checkbutton(text='Is after November 9, 1989', variable=checked_state, command=checkbutton_used)
my_checkbutton.pack(pady=2)
window.mainloop()

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View file

@ -0,0 +1,39 @@
# This code is not very clean. At all. I might clean it up later.
import time
import tkinter as tk
from tkinter import ttk
from PIL import Image, ImageTk
import os
window = tk.Tk()
window.title('We are number one! (Hey!)')
# width & height don't need to be there explicitly, but improves readability
window.minsize(width=800, height=450)
# window.maxsize(width=800, height=600) # By default monitor size
# Label
top_text = tk.Label(text="Here's a little lesson in trickery", font='Arial 18 bold')
top_text.pack(pady=5, side=tk.TOP)
bottom_text = tk.Label(text='This is going down in history', font='Arial 18 bold')
bottom_text.pack(pady=5, side=tk.BOTTOM)
# Image loading
file_name = 'images/we are number one.webp'
load = Image.open(file_name)
thickness = 2
CANVAS_WIDTH = load.width - (thickness * 2)
CANVAS_HEIGHT = load.height - (thickness * 2)
canvas = tk.Canvas(width=CANVAS_WIDTH, height=CANVAS_HEIGHT,
highlightcolor='black', highlightbackground='black',
highlightthickness=thickness)
image_container = canvas.create_image(CANVAS_WIDTH // 2, CANVAS_HEIGHT // 2)
canvas.pack(padx=5, pady=5)
img = ImageTk.PhotoImage(load)
canvas.itemconfig(image_container, image=img)
canvas.imgref = img
# This must be at the end of your program
window.mainloop()

View file

@ -1,4 +1,4 @@
print('This is my notes') print('This is my notes')
print('This includes markdown files, and lots of python programs') print('This includes markdown files, and lots of python programs')
print('And remember:\n') print('And remember:\n')
import this import this