renaming files

This commit is contained in:
Tom Schimansky 2022-04-05 22:55:22 +02:00
parent c942ee8e05
commit a4e8d30535
12 changed files with 128 additions and 54 deletions

View File

@ -1,4 +1,4 @@
__version__ = "3.6"
__version__ = "3.8"
from .customtkinter_input_dialog import CTkInputDialog
from .customtkinter_button import CTkButton

View File

@ -19,7 +19,7 @@ def read(filename):
setup(name="customtkinter",
version="3.6",
version="3.8",
author="Tom Schimansky",
license="Creative Commons Zero v1.0 Universal",
url="https://github.com/TomSchimansky/CustomTkinter",

View File

@ -1,52 +0,0 @@
import tkinter
import customtkinter # <- import the CustomTkinter module
root_tk = customtkinter.CTk() # create CTk window like you do with the Tk window (you can also use normal tkinter.Tk window)
#root_tk = tkinter.Tk()
root_tk.geometry("400x300")
root_tk.title("CustomTkinter Test")
customtkinter.set_appearance_mode("System") # Other: "Dark", "Light"
def rgb2hex(rgb_color: tuple) -> str:
return "#{:02x}{:02x}{:02x}".format(round(rgb_color[0]), round(rgb_color[1]), round(rgb_color[2]))
def slider_function(value):
progressbar_1.set(value)
col_1 = rgb2hex((100, 50, value * 250))
col_2 = rgb2hex((100, value * 250, 100))
root_tk.config(bg=col_1)
#root_tk["background"] = (col_1, col_2)
#frame_1["bg_color"] = col_1
frame_1.configure(fg_color=col_2)
#frame_1.configure(fg_color=bg_col)
frame_1 = customtkinter.CTkFrame(master=root_tk, width=300, height=200, corner_radius=15)
frame_1.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
label_1 = customtkinter.CTkLabel(master=frame_1)
label_1.place(relx=0.5, rely=0.1, anchor=tkinter.CENTER)
progressbar_1 = customtkinter.CTkProgressBar(master=frame_1)
progressbar_1.place(relx=0.5, rely=0.25, anchor=tkinter.CENTER)
button_1 = customtkinter.CTkButton(master=frame_1, corner_radius=10)
button_1.place(relx=0.5, rely=0.4, anchor=tkinter.CENTER)
button_1.configure(state="disabled")
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_function, from_=0, to=1, progress_color="gray20")
slider_1.place(relx=0.5, rely=0.55, anchor=tkinter.CENTER)
#slider_1.set(1.5)
entry_1 = customtkinter.CTkEntry(master=frame_1)
entry_1.place(relx=0.5, rely=0.75, anchor=tkinter.CENTER)
checkbox_1 = customtkinter.CTkCheckBox(master=root_tk)
checkbox_1.place(relx=0.5, rely=0.9, anchor=tkinter.CENTER)
#frame_1.config(bg_color="red")
root_tk.mainloop()

73
test/test_askdialog.py Normal file
View File

@ -0,0 +1,73 @@
from tkinter.constants import CENTER, LEFT
import tkinter
import tkinter.messagebox
from tkinter import filedialog as fd
import customtkinter # <- import the CustomTkinter module
import os
class App(customtkinter.CTk):
customtkinter.set_appearance_mode("dark")
APP_NAME = "Bulk Barcode Generator"
WIDTH = 600
HEIGHT = 450
MAIN_COLOR = "#5ea886"
MAIN_COLOR_DARK = "#2D5862"
MAIN_HOVER = "#05f4b7"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title(App.APP_NAME)
self.geometry(str(App.WIDTH) + "x" + str(App.HEIGHT))
self.minsize(App.WIDTH, App.HEIGHT)
self.protocol("WM_DELETE_WINDOW", self.on_closing)
# ============ create two CTkFrames ============
#1
self.frame_left = customtkinter.CTkFrame(master=self,
width=220,
height=App.HEIGHT-40,
corner_radius=5)
self.frame_left.place(relx=0.38, rely=0.5, anchor=tkinter.E)
#2
self.frame_right = customtkinter.CTkFrame(master=self,
width=350,
height=App.HEIGHT-40,
corner_radius=5)
self.frame_right.place(relx=0.40, rely=0.5, anchor=tkinter.W)
# # ============ frame_right ============
self.button_output = customtkinter.CTkButton(master=self.frame_right, border_color=App.MAIN_COLOR,
fg_color=None, hover_color=App.MAIN_HOVER,
height=28, text="Output Folder", command=self.button_outputFunc,
border_width=3, corner_radius=10, text_font=('Calibri',16))
self.button_output.place(relx=0.05, rely=0.06, anchor=tkinter.NW)
self.entry_output = customtkinter.CTkEntry(master=self.frame_right, width=320, height=38, corner_radius=5)
self.entry_output.place(relx=0.05, rely=0.18, anchor=tkinter.NW)
def button_outputFunc(self):
self.entry_output.delete(0, 'end')
filename = fd.askdirectory()
self.entry_output.insert(0,str(filename))
pass
def on_closing(self, event=0):
self.destroy()
def start(self):
self.mainloop()
if __name__ == "__main__":
app = App()
app.start()

View File

@ -0,0 +1,53 @@
import customtkinter
import tkinter
# customtkinter.set_appearance_mode("light")
root_tk = customtkinter.CTk()
root_tk.geometry("600x500")
menu = tkinter.Menu(tearoff=0, bd=0, relief=tkinter.FLAT, activeforeground="red")
menu.add_command(label="System")
menu.add_command(label="Light")
menu.add_command(label="Dark")
class CTkMenu(tkinter.Toplevel):
def __init__(self, master, x, y, options):
super().__init__(bg="black")
super().overrideredirect(True)
#self.wm_attributes("-transparentcolor", "black")
super().geometry(f"120x{len(options) * (25 + 4) + 4}+{x}+{y}")
super().lift()
super().transient(master)
self.resizable(False, False)
super().focus_force()
self.focus()
self.frame = customtkinter.CTkFrame(self, border_width=0, width=120, corner_radius=10, border_color="gray4", fg_color="#333740")
self.frame.grid(row=0, column=0, sticky="nsew", rowspan=len(options) + 2, columnspan=1)
self.frame.grid_rowconfigure(0, minsize=2)
self.frame.grid_rowconfigure(len(options) + 1, minsize=2)
self.grid_columnconfigure(0, weight=1)
self.buttons = []
for index, option in enumerate(options):
button = customtkinter.CTkButton(self.frame, height=25, width=108, fg_color="#333740", text_color="gray74", hover_color="#272A2E", corner_radius=8)
button.text_label.grid(row=0, column=0, rowspan=2, columnspan=2, sticky="w")
button.grid(row=index + 1, column=0, padx=4, pady=2)
self.buttons.append(button)
# master.bind("<Configure>", self.window_drag())
def open_menu():
menu = CTkMenu(root_tk, button.winfo_rootx(), button.winfo_rooty() + button.winfo_height() + 4, ["Option 1", "Option 2", "Point 3"])
button = customtkinter.CTkButton(command=open_menu, height=50)
button.pack(pady=20)
root_tk.mainloop()