In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use the Tkinter column window control PanedWindow". In the daily operation, I believe that many people have doubts about how to use the Tkinter column window control PanedWindow. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use the Tkinter column window control PanedWindow". Next, please follow the editor to study!
Simple dialog-level layouts will not be adjusted once they are decided. However, for larger images such as the IDE development environment, you may need to dynamically resize the functional partition, so you need the column window control PanedWindow.
The construction of this control is very simple. Setting the background property in the code is not necessary, just to represent the scope of the control.
Paned_window = PanedWindow (root, background= "# a0ffa0")
Build the Lisbox partition on the left and set its action, this part of the code comes from the previous example. The last line adds Listbox to the PanedWindow.
# create fontftiTimes = Font (family='Times', size=24, weight=BOLD)
# create a listbox for demo.lb = Listbox (paned_window, activestyle='dotbox', bg= "# ffffa0", fg= "# ff0000", disabledforeground= "# 3f3f3f", highlightbackground= "# 0000ff", font=ftiTimes, height=10, width=20)
# add itemsfor i in range (0jue 20): lb.insert (END, str (I))
# bind eventlb.bind ('', lambda e: label.config (text=str (lb.curselection () paned_window.add (lb)
Build a Frame control that contains a Text control and horizontal and vertical scroll bars and add it to the PanedWindow. When you add edit_area to paned_window, specify the padx and pady attributes plus the background color at the top. The result is that you can see the boundary between edit_area and paned_window, which is not necessary for actual development.
Edit_area = Frame (paned_window)
# create text widget.text = Text (edit_area, background= "# a0ffa0", foreground= "# 000000", wrap=NONE) text.grid (row = 0, column = 0, sticky=W+N+E+S)
Scroll_ty = Scrollbar (edit_area, orient=VERTICAL, command=text.yview) scroll_ty.grid (row=0, column=1, sticky=N+S) text ['yscrollcommand'] = scroll_ty.set
Scroll_tx = Scrollbar (edit_area, orient=HORIZONTAL, command=text.xview) scroll_tx.grid (row=1, column=0, sticky=E+W) text ['xscrollcommand'] = scroll_tx.set
Edit_area.grid_rowconfigure (0, weight=1) edit_area.grid_columnconfigure (0, weight=1)
Paned_window.add (edit_area, sticky=W+N+E+S, padx=2, pady=2)
The purpose of 17 lines and 18 lines of code is that when the size of the edit_area changes, the size of the Text control changes and the width of the Scrollbar remains the same.
Place paned_window on the first line of the root window:
Paned_window.grid (row = 0, column = 0, sticky=N+S+W+E)
The second line arranges a label control that represents information.
Label=Label (root) label.grid (row=1, column=0)
Set the row and column properties of the following window to ensure that the size of paned_window and label changes correctly when you drag the root window.
At this point, on the "Tkinter column window control PanedWindow how to use" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.