Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. def render_gui(self):
  2.  
  3. self.main_window = tk.Tk()
  4. self.main_window.geometry("1000x600")
  5. self.main_window.title("Damaged Text Document Virtual Restoration")
  6. self.main_window.resizable(True, True)
  7. self.main_window.configure(background="#d9d9d9")
  8. self.main_window.configure(highlightbackground="#d9d9d9")
  9. self.main_window.configure(highlightcolor="black")
  10.  
  11.  
  12. self.main_canvas = tk.Canvas(self.main_window, bg = "yellow")
  13. self.main_canvas.pack(expand = True, fill = "both")
  14.  
  15. vsb = tk.Scrollbar(self.main_canvas, orient="vertical", command=self.main_canvas.yview)
  16. hsb = tk.Scrollbar(self.main_canvas, orient="horizontal", command=self.main_canvas.xview)
  17. vsb.grid(row=1, column=50,columnspan = 20, sticky='ns')
  18. hsb.grid(row=20, column=1,rowspan = 20,sticky = 'wes')
  19.  
  20. self.main_canvas.configure(yscrollcommand=vsb.set,xscrollcommand=hsb.set)
  21. self.main_window.mainloop()
  22.  
  23. import tkinter as tk
  24.  
  25. class test:
  26. def __init__(self):
  27. self.render_gui()
  28.  
  29. def render_gui(self):
  30. self.main_window = tk.Tk()
  31. self.main_window.geometry("1000x600")
  32. self.main_window.title("Damaged Text Document Virtual Restoration")
  33. self.main_window.resizable(True, True)
  34. self.main_window.configure(background="#d9d9d9")
  35. self.main_window.configure(highlightbackground="#d9d9d9")
  36. self.main_window.configure(highlightcolor="black")
  37.  
  38. self.main_canvas = tk.Canvas(self.main_window, bg = "yellow")
  39. vsb = tk.Scrollbar(self.main_window, orient="vertical", command=self.main_canvas.yview)
  40. hsb = tk.Scrollbar(self.main_window, orient="horizontal", command=self.main_canvas.xview)
  41. hsb.pack(side = "bottom", fill = "x")
  42. vsb.pack(side = "right", fill = "y")
  43. self.main_canvas.pack(expand = True, fill = "both")
  44.  
  45. self.main_canvas.configure(yscrollcommand=vsb.set,xscrollcommand=hsb.set)
  46. self.main_window.mainloop()
  47.  
  48. t = test()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement