8000 revert to original version · Tri3st/complete-python-course@0f388bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f388bf

Browse files
committed
revert to original version
1 parent 7ce5bea commit 0f388bf

File tree

1 file changed

+10
-6
lines changed
  • course_contents/19_gui_development_tkinter/lectures/17_adding_permanent_scrollbar

1 file changed

+10
-6
lines changed

course_contents/19_gui_development_tkinter/lectures/17_adding_permanent_scrollbar/app.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ def check_for_changes():
1717

1818

1919
def get_text_widget():
20-
text_widget = notebook.nametowidget(notebook.select())
20+
current_tab = notebook.nametowidget(notebook.select())
21+
text_widget = current_tab.winfo_children()[0]
22+
2123
return text_widget
2224

2325

@@ -65,16 +67,19 @@ def confirm_quit():
6567

6668

6769
def create_file(content="", title="Untitled"):
68-
text_area = tk.Text(notebook)
70+
container = ttk.Frame(notebook)
71+
container.pack()
72+
73+
text_area = tk.Text(container)
6974
text_area.insert("end", content)
7075
text_area.pack(si 8000 de="left", fill="both", expand=True)
7176

72-
notebook.add(text_area, text=title)
73-
notebook.select(text_area)
77+
notebook.add(container, text=title)
78+
notebook.select(container)
7479

7580
text_contents[str(text_area)] = hash(content)
7681

77-
text_scroll = ttk.Scrollbar(text_area, orient="vertical", command=text_area.yview)
82+
text_scroll = ttk.Scrollbar(container, orient="vertical", command=text_area.yview)
7883
text_scroll.pack(side="right", fill="y")
7984
text_area["yscrollcommand"] = text_scroll.set
8085

@@ -122,7 +127,6 @@ def show_about_info():
122127

123128

124129
root = tk.Tk()
125-
root.geometry("600x400")
126130
root.title("Teclado Text Editor")
127131
root.option_add("*tearOff", False)
128132

< 3218 code class="diff-text-cell hunk">

0 commit comments

Comments
 (0)
0