| from tkinter import *
|
| from tkinter import ttk
|
|
|
| # opcje
|
|
|
| htmltemplate = """<!DOCTYPE html>
|
| <html>
|
| <head>
|
| <title>Hello world !</title>
|
| <body>
|
| <p>test app</p>
|
| </body>
|
| </html>
|
| """
|
|
|
| # odtad sam kod
|
|
|
| global path
|
|
|
| def Save_Window():
|
| Window = tk.Toplevel()
|
| textsave = ttk.Entry(Window)
|
| textsave.pack()
|
| path = textsave.get()
|
|
|
| def save():
|
| savefile = text.get('1.0', 'end')
|
| with open(path, 'w') as f:
|
| f.write(savefile)
|
|
|
| root = Tk()
|
| root.title("test")
|
|
|
| frame = ttk.Frame(root)
|
|
|
| text = Text(frame, width=100, height=25)
|
| text.pack()
|
| text.insert('1.0', htmltemplate)
|
| root.bind('<Control-s>', save)
|
|
|
| frame.pack()
|
|
|
| root.mainloop()
|