Tkinter tutorial value PaneWindow

Source: Internet
Author: User
Tags tkinter tutorial
'''Tkinter tutorial value PaneWindow '''
# PaneWindow (panel) is a gm used to manage child Widgets
'''1. Add Pane ''' to the PanedWindow '''
# Use the add Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Panes = PanedWindow (orient = VERTICAL)
Panes. pack (fill = BOTH, expand = 1)
For w in [Label, Button, Checkbutton, Radiobutton]:
Panes. add (w (panes, text = 'hello '))
Root. mainloop ()
# Create a widget in each pane
'''2. Delete the pane ''' specified by PanedWindow '''
# Use the forget/remove Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Ws = []
Panes = PanedWindow (orient = VERTICAL)
Panes. pack (fill = BOTH, expand = 1)
# Create four pane
For w in [Label, Button, Checkbutton, Radiobutton]:
Ws. append (w (panes, text = 'hello '))
For w in ws:
Panes. add (w)
# Delete pane containing sub-buttons from panes and use remove to be the same as forget
Panes. forget (ws [1])
# Panes. remove (ws [1])
Root. mainloop ()
# There are only three widgets, and the Button has been deleted.
''' 3. Add a pane ''' at the specified position in the PanedWindow '''
# Use the paneconfig Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Ws = []
Ps = PanedWindow (orient = VERTICAL)
Ps. pack (fill = BOTH, expand = 1)
# Create four pane
For w in [Label, Button, Checkbutton, Radiobutton]:
Ws. append (w (ps, text = 'hello '))
For w in ws:
Ps. add (w)
# Add a Lable after 0. An error occurred !!!
# Ps. after (ws [0], Label (ps, text = 'World '))
# Note that the added widget is the first parameter, and the after parameter is specified after that widget.
# Do not confuse it with the after Method
Ps. paneconfig (Label (ps, text = 'World'), after = ws [0])
Root. mainloop ()
# This widget is mainly used for Container and uses a large number of gm methods.

# Author: jcodeer
# Blog: jcodeer.cublog.cn
# Email: jcodeer@126.com

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.