In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to use the Sizegrip control in Python, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The first is to build the main window.
Root = Tk () root.title ('Tkinter Sizegrip Demo V1.0')
Screen_w = root.winfo_screenwidth () screen_h = root.winfo_screenheight () root.maxsize (width=screen_w, height=screen_h) rw = int (screen_w / 2) rh = int (screen_h / 2) root.geometry ('{} x {} + {: G} + {: G} '.format (rw, rh, rw / 2, rh / 2))
In addition to specifying the window title, the code also centers the window. Next is to build the exit menu:
Top_menu = Menu (root) root.config (menu=top_menu)
File_menu = Menu (top_menu, tearoff=False) top_menu.add_cascade (label='File', menu=file_menu) file_menu.add_command (label= "Exit", command=root.quit)
For ease of management, first generate a Frame control that manages the editor control:
Edit_area = Frame (root) edit_area.grid (row=1, column=0)
The Text control is also resized when it is generated. Because the height and width of Text are specified in characters, it takes a lot of trouble. If you do not resize the Text, when the size of the root window reaches a certain value, the Text will no longer follow the size of the window.
# create text widget.
Font= Font (family='Arial', size=15), text = Text (edit_area, font=font, height=80, wrap=NONE) text.config (width=int (text ['width'] * screen_w / text.winfo_reqwidth ()), height=int (text [' height'] * screen_h / text.winfo_reqheight ()) text.grid (row=0, column=0, sticky='nsew')
The result of text.config execution is to resize the Text control to the same size as the screen. Next, it is standard practice to build scroll bar controls.
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
Sizegrip itself is simple:
Sizegrip (edit_area) .grid (row=1, column=1) the above is how to use Sizegrip controls in Python. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.