Merge remote-tracking branch 'origin/master'

This commit is contained in:
ben 2022-07-28 13:05:10 -05:00
commit dfe7a75eea
6 changed files with 83 additions and 4 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

View file

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (venv)" jdkType="Python SDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</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,38 @@
import tkinter as tk
from PIL import Image, ImageTk
window = tk.Tk()
window.title('We are number one! (Hey!)')
# width & height don't need to be specified, but they are here for clarity
window.minsize(width=800, height=450)
# window.maxsize(width=800, height=600) # By default monitor size
# Label(s)
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)
# Loading image into a PIL image object
file_name = 'images/we are number one.webp'
load = Image.open(file_name)
# Setting up canvas (and image on it)
thickness = 2
CANVAS_WIDTH = load.width - (thickness * 2) # Accounts for border around image, makes image overlap with border,
CANVAS_HEIGHT = load.height - (thickness * 2) # effectively slightly cropping the image.
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)
# Loading image onto canvas
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,9 @@
import time
print('This is my notes')
print('This includes markdown files, and lots of python programs')
print('And remember:\n')
import this
print('\nAnd remember, do this:\n')
import this
print('\nAnd not that:\n')
import that