SHARE
TWEET

Untitled

a guest Aug 20th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import tkinter
  3. from tkinter import scrolledtext
  4.  
  5. main_window = tkinter.Tk()
  6. main_window.geometry('1280x720')
  7. main_window.title('Text Editor 3000')
  8.  
  9. def open_file(filename):
  10.     pass
  11.  
  12. files = os.listdir('.')
  13. for i in range(len(files)):
  14.     filename = files[i]
  15.     btn = tkinter.Button(main_window, text=filename,
  16.                          font=('Consolas', 14),
  17.                          command=lambda: open_file(filename))
  18.     btn.grid(column=0, row=i)
  19.  
  20. def create_new(file):
  21.     pass
  22.  
  23. def save_file():
  24.     pass
  25.  
  26. new_btn = tkinter.Button(main_window, text='Create new file',
  27.                          font=('Consolas', 14), command=create_new)
  28. new_btn.grid(column=1, row=0)
  29.  
  30. new_btn = tkinter.Button(main_window, text='Save file',
  31.                          font=('Consolas', 14), command=save_file)
  32. new_btn.grid(column=2, row=0)
  33.  
  34. filename = tkinter.Entry(main_window, width=20)
  35. filename.grid(column=3, row=0)
  36.  
  37. txt = scrolledtext.ScrolledText(main_window, width=100, height=30)
  38. txt.grid(column=1, row=1, columnspan=10, rowspan=10)
  39.  
  40. main_window.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top