Add button to open current folder

Works on windows
Fix #3
This commit is contained in:
Shikiryu 2023-05-23 19:36:15 +02:00
parent 7722b4f294
commit 4f5f7104e5
2 changed files with 12 additions and 4 deletions

2
app.py
View File

@ -46,7 +46,7 @@ class App:
self.launch_button.pack(side="bottom")
def lets_draw(self):
self.image_window = ImageWindow(self.root)
self.image_window = ImageWindow(self)
self.image_window.lets_draw(self.found_images.copy(), self.timer)
def select_folder(self):

View File

@ -1,3 +1,4 @@
import os
import random
from tkinter import *
from PIL import ImageTk, Image, ImageOps
@ -5,8 +6,9 @@ from util import Util
class ImageWindow:
def __init__(self, window):
self.window = Toplevel(window)
def __init__(self, app):
self.app = app
self.window = Toplevel(app.root)
self.window.title("Image")
self.window.geometry("1280x1024")
self.option = {
@ -32,6 +34,10 @@ class ImageWindow:
self.mirror_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_mirror, text="mirror")
self.mirror_button.pack(side=LEFT, padx=0, pady=0)
self.open_folder_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.open_folder
, text="open folder")
self.open_folder_button.pack(side=LEFT, padx=0, pady=0)
self.timer_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_timer, text="timer")
self.timer_button.pack(side=LEFT, padx=0, pady=0)
@ -74,7 +80,9 @@ class ImageWindow:
self.timer_label.pack_forget()
except TclError:
self.timer_label.pack(side=RIGHT, ipadx=20)
# self.timer_label.config()
def open_folder(self):
os.startfile(self.app.selected_folder)
def lets_draw(self, images, timer):
random.shuffle(images)