I've found out how to create a replacement logo for Tk, and to remove the Tk from the window. I have not however been able to find any existence on how to sticky any buttons or such. I've tried creating a class, and a def create_widget, but for some reason I'm getting errors in PyDev debugging. It keeps saying sticky = N + E is undefined. I thought importing ttk would automatically allow me to edit these buttons via self, but when I do self I have to change everything around and then the imports won't allow root. I believe this problem is because I'm not importing the right way, due to the fact I have replaced the logo and removed tk. My question is, how does .pack work and is there something I'm missing majorly in this code?
from tkinter import ttk
import tkinter
import tempfile
ICON = (b'\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x08\x00h\x05\x00\x00'
b'\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00'
b'\x08\x00\x00\x00\x00\x00@\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
b'\x00\x01\x00\x00\x00\x01') + b'\x00'*1282 + b'\xff'*64
_, ICON_PATH = tempfile.mkstemp()
with open(ICON_PATH, 'wb') as icon_file:
icon_file.write(ICON)
root = tkinter.Tk()
buttonstyle = ttk.Style()
buttonstyle.map("C.TButton",
foreground=[('pressed', 'red'), ('active', 'blue')],
background=[('pressed', '!disabled', 'black'), ('active', 'white')]
)
colored_btn = ttk.Button(text="Activate", style="C.TButton").pack()
b = ttk.Button(root, text='Rename')
b.pack()
style = ttk.Style()
style.theme_settings("default", {
"TCombobox": {
"configure": {"padding": 5},
"map": {
"background": [("active", "green2"),
("!disabled", "green4")],
"fieldbackground": [("!disabled", "green3")],
"foreground": [("focus", "OliveDrab1"),
("!disabled", "OliveDrab2")]
}
}
})
combo = ttk.Combobox().pack()
style.layout("TMenubutton", [
("Menubutton.background", None),
("Menubutton.button", {"children":
[("Menubutton.focus", {"children":
[("Menubutton.padding", {"children":
[("Menubutton.label", {"side": "left", "expand": 1})]
})]
})]
}),
])
mbtn = ttk.Menubutton(text='Rename')
mbtn.pack()
root.title("Rename")
root.iconbitmap(default = ICON_PATH)
root.geometry("700x300")
label = ttk.Label(root, text = "Rename")
label.pack()
root.mainloop()