Skip to content

Commit 5f34b50

Browse files
committed
cleanup
1 parent db08385 commit 5f34b50

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,15 @@ def preparewindow():
3939
root.resizable(True, True)
4040
editor.build(cfg, theme, root)
4141

42-
def openfile():
42+
def openfile(path):
4343
preparewindow()
44-
tabmanager.openfile()
45-
46-
def openlast():
47-
preparewindow()
48-
tabmanager.openfile(path=content)
44+
tabmanager.openfile(path=path)
4945

5046
title = tkinter.Label(root, text="Onyx Editor", font=("Segoe UI", 20, "bold")).pack(anchor="nw", padx=20, pady=20)
5147
btncreatenew = ttk.Button(root, text="Create New File", command=preparewindow).pack(anchor="nw", padx=20)
52-
btnopenfile = ttk.Button(root, text="Open File", command=openfile).pack(anchor="nw", pady=10, padx=20)
48+
btnopenfile = ttk.Button(root, text="Open File", command=lambda: openfile(path="")).pack(anchor="nw", pady=10, padx=20)
5349
btnopendir = ttk.Button(root, text="Open Directory", state="disabled").pack(anchor="nw", padx=20)
54-
btnopenlast = ttk.Button(root, text="Open last file", command=openlast)
50+
btnopenlast = ttk.Button(root, text="Open last file", command=lambda: openfile(path=content))
5551
btnopenlast.pack(anchor="nw", padx=20, pady=20)
5652

5753
file = open("lastfile.txt", "r")

0 commit comments

Comments
 (0)