coretk change to set a core-icon

This commit is contained in:
Blake Harnden 2019-09-15 16:38:12 -07:00
parent 28e1e7d796
commit bcb7bf4a10
2 changed files with 12 additions and 6 deletions

View file

@ -1,4 +1,5 @@
import tkinter as tk import tkinter as tk
from PIL import Image, ImageTk
from coretk.graph import CanvasGraph from coretk.graph import CanvasGraph
@ -6,18 +7,27 @@ from coretk.graph import CanvasGraph
class Application(tk.Frame): class Application(tk.Frame):
def __init__(self, master=None): def __init__(self, master=None):
super().__init__(master) super().__init__(master)
self.master.title("CORE")
self.master.geometry("800x600")
self.master.state("zoomed")
self.set_icon()
self.pack(fill=tk.BOTH, expand=1) self.pack(fill=tk.BOTH, expand=1)
self.images = [] self.images = []
self.menubar = None self.menubar = None
self.create_menu() self.create_menu()
self.create_widgets() self.create_widgets()
def set_icon(self):
image = Image.open("core-icon.png")
tk_image = ImageTk.PhotoImage(image)
self.master.tk.call("wm", "iconphoto", self.master._w, tk_image)
def create_menu(self): def create_menu(self):
self.master.option_add("*tearOff", tk.FALSE) self.master.option_add("*tearOff", tk.FALSE)
self.menubar = tk.Menu(self.master) self.menubar = tk.Menu(self.master)
file_menu = tk.Menu(self.menubar) file_menu = tk.Menu(self.menubar)
file_menu.add_command(label="Open") file_menu.add_command(label="Open")
file_menu.add_command(label="Exit", command=root.quit) file_menu.add_command(label="Exit", command=self.master.quit)
self.menubar.add_cascade(label="File", menu=file_menu) self.menubar.add_cascade(label="File", menu=file_menu)
help_menu = tk.Menu(self.menubar) help_menu = tk.Menu(self.menubar)
self.menubar.add_cascade(label="Help", menu=help_menu) self.menubar.add_cascade(label="Help", menu=help_menu)
@ -60,9 +70,5 @@ class Application(tk.Frame):
if __name__ == "__main__": if __name__ == "__main__":
root = tk.Tk() app = Application()
root.title("Graph Canvas")
root.geometry("800x600")
root.state("zoomed")
app = Application(master=root)
app.mainloop() app.mainloop()

BIN
coretk/coretk/core-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB