templates
This commit is contained in:
parent
39bd56ecdc
commit
e0a71464c6
BIN
drawing.png
BIN
drawing.png
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
freeze_frame.jpg
BIN
freeze_frame.jpg
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 12 KiB |
65
kiosk6.py
65
kiosk6.py
|
@ -2,11 +2,8 @@
|
|||
|
||||
import tkinter as tk
|
||||
from tkinter import font as tkfont
|
||||
from tkinter import Canvas
|
||||
from tkinter import ttk
|
||||
from tkinter import Text
|
||||
from tkinter import Canvas, ttk, Text, filedialog, messagebox
|
||||
from PIL import Image, ImageTk, ImageDraw
|
||||
from tkinter import messagebox
|
||||
import tozpl
|
||||
import subprocess
|
||||
import threading
|
||||
|
@ -55,7 +52,7 @@ class Kiosk(tk.Tk):
|
|||
|
||||
def add_home_button(self, frame):
|
||||
# Create the "Start Over" button
|
||||
home_button = tk.Button(frame, text="Start Over", command=lambda: self.switch_frame(Screen0), bg='peach puff', font=BUTTON_FONT)
|
||||
home_button = tk.Button(frame, text="Start Over from the beginning", command=lambda: self.switch_frame(Screen0), bg='peach puff', width=24, font=BUTTON_FONT)
|
||||
home_button.place(x=0, y=0) # top-left corner
|
||||
|
||||
# home screen
|
||||
|
@ -347,23 +344,22 @@ class Screen4(tk.Frame):
|
|||
self.grid_columnconfigure(1, minsize=100)
|
||||
self.grid_columnconfigure(2, minsize=100)
|
||||
|
||||
# Creating a frame for the left side of the screen for drawing
|
||||
# Creating a frame for the left side of the screen for drawing and instructions
|
||||
self.left_frame = tk.Frame(self, bg='#bcfef9')
|
||||
self.left_frame.grid(row=0, column=0, padx=20)
|
||||
|
||||
# Frame for the instructions
|
||||
self.center_frame = tk.Frame(self, bg='#bcfef9')
|
||||
self.center_frame.grid(row=0, column=1, padx=20)
|
||||
self.left_frame.grid(row=0, column=0, padx=2)
|
||||
|
||||
# Frame for the tools
|
||||
self.right_frame = tk.Frame(self, bg='#bcfef9')
|
||||
self.right_frame.grid(row=0, column=2, padx=60)
|
||||
self.right_frame.grid(row=0, column=2, padx=70)
|
||||
|
||||
# Add Import Image Button
|
||||
tk.Button(self.left_frame, text="Import Image", command=self.import_image, height=2, width=15, bg='peach puff', font=BUTTON_FONT).pack(pady=10)
|
||||
|
||||
# Add instructions
|
||||
self.label = tk.Label(self.left_frame, text="You may now draw your sticker :) This will be printed ~ 1.25 by 2.25 inches. You can include contact info for yourself, the name of the item, a drawing, or whatever you want, it's your artistic expression. You might have better results using thicker lines (see drawing tools on the right). In the bottom right of the sticker will be a small QR code which links to the Scuttlebutt post for your item. The image you are drawing now will not be posted to Scuttlebutt.",
|
||||
wraplength=600, # adjust to suit needs
|
||||
wraplength=650, # adjust to suit needs
|
||||
font=TEXT_FONT)
|
||||
self.label.pack(pady=10)
|
||||
self.label.pack(pady=2)
|
||||
|
||||
# is this the drawing area
|
||||
self.drawing = Image.new('1', (635, 360), 1)
|
||||
|
@ -377,13 +373,11 @@ class Screen4(tk.Frame):
|
|||
# Creating the Canvas for drawing
|
||||
self.canvas = Canvas(self.left_frame, width=635, height=360, bg='white')
|
||||
self.canvas.bind("<B1-Motion>", self.draw_line)
|
||||
self.image_on_canvas = None # To store imported image's reference
|
||||
self.canvas.pack(pady=20)
|
||||
self.canvas.bind("<ButtonRelease-1>", self.reset_last_draw)
|
||||
self.add_qr_box() # Add QR box to the canvas
|
||||
|
||||
|
||||
|
||||
|
||||
#Create a frame for the buttons grid
|
||||
self.buttons_frame = tk.Frame(self.right_frame, bg='#bcfef9')
|
||||
self.buttons_frame.pack(pady=50)
|
||||
|
@ -403,10 +397,10 @@ class Screen4(tk.Frame):
|
|||
self.color_label.pack(pady=5)
|
||||
|
||||
# Add Clear Drawing Button
|
||||
tk.Button(self.right_frame, text="clear drawing", command=self.clear_drawing, height=3, width=20, bg='peach puff', font=BUTTON_FONT).pack(pady=10)
|
||||
tk.Button(self.right_frame, text="clear drawing", command=self.clear_drawing, height=2, width=10, bg='peach puff', font=BUTTON_FONT).pack(pady=10)
|
||||
|
||||
# Done button
|
||||
tk.Button(self.right_frame, text="Done", command=self.next, height=3, width=30, bg='peach puff', font=BUTTON_FONT).pack(pady=10)
|
||||
tk.Button(self.right_frame, text="Done", command=self.next, height=3, width=10, bg='peach puff', font=BUTTON_FONT).pack(pady=10)
|
||||
|
||||
# Adding a home button
|
||||
master.add_home_button(self.right_frame)
|
||||
|
@ -444,7 +438,40 @@ class Screen4(tk.Frame):
|
|||
self.canvas.create_rectangle(506, 217, 627, 346, outline='black', fill='white')
|
||||
self.canvas.create_text(540, 260, text="QR", fill="black")
|
||||
|
||||
def import_image(self):
|
||||
# Open file dialog to select an image file
|
||||
file_path = filedialog.askopenfilename(filetypes=[("Image files", "*.jpg *.png")])
|
||||
|
||||
if file_path:
|
||||
# Check if the selected file has a correct extension
|
||||
if not (file_path.lower().endswith('.jpg') or file_path.lower().endswith('.png')):
|
||||
tk.messagebox.showerror("Invalid file", "Please select a .jpg or .png file.")
|
||||
return
|
||||
|
||||
# Load the image
|
||||
img = Image.open(file_path)
|
||||
|
||||
# Convert to 1-bit black and white
|
||||
img = img.convert('1')
|
||||
|
||||
# Resize or crop the image to fit the canvas
|
||||
if img.size[0] > 635 or img.size[1] > 360:
|
||||
img = img.crop((0, 0, 635, 360))
|
||||
|
||||
# Paste the imported image onto the drawing image
|
||||
self.drawing.paste(img)
|
||||
|
||||
# Save image reference to avoid garbage collection
|
||||
self.imported_img = ImageTk.PhotoImage(img)
|
||||
|
||||
# Clear the canvas
|
||||
self.canvas.delete("all")
|
||||
|
||||
# Add image to the canvas
|
||||
self.image_on_canvas = self.canvas.create_image(0, 0, image=self.imported_img, anchor='nw')
|
||||
|
||||
# Re-add QR box overlay
|
||||
self.add_qr_box()
|
||||
|
||||
|
||||
# typed description
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,20 @@
|
|||
# WARNING: Never show this to anyone.
|
||||
# WARNING: Never edit it or use it on multiple devices at once.
|
||||
#
|
||||
# This is your SECRET, it gives you magical powers. With your secret you can
|
||||
# sign your messages so that your friends can verify that the messages came
|
||||
# from you. If anyone learns your secret, they can use it to impersonate you.
|
||||
#
|
||||
# If you use this secret on more than one device you will create a fork and
|
||||
# your friends will stop replicating your content.
|
||||
#
|
||||
{
|
||||
"curve": "ed25519",
|
||||
"public": "T+gn2d5BoDX3kQg2pVnNI5IEM5uopwSc57c2wxC/WGw=.ed25519",
|
||||
"private": "FR/NaJvY+JUoIuHxUVuu0PGdmRAAJou9OxStHZKkLSVP6CfZ3kGgNfeRCDalWc0jkgQzm6inBJzntzbDEL9YbA==.ed25519",
|
||||
"id": "@T+gn2d5BoDX3kQg2pVnNI5IEM5uopwSc57c2wxC/WGw=.ed25519"
|
||||
}
|
||||
#
|
||||
# The only part of this file that's safe to share is your public name:
|
||||
#
|
||||
# @T+gn2d5BoDX3kQg2pVnNI5IEM5uopwSc57c2wxC/WGw=.ed25519
|
Loading…
Reference in New Issue