top of page

Python Tkinter

Public·1 member

Tkinter Tutorial: 10 | Tkinter PanedWindow, Tkinter Radiobutton

The PanedWindow widget is a geometry manager widget, which can contain one or more child widgets (“panes”).


Syntax:

w = PanedWindow( master, option, ... )

Here:

  • master − This represents the parent window.

  • options − Here is the list of most commonly used options for this widget.


Example

To show the 2 pane window:

from Tkinter import *

m = PanedWindow(orient=VERTICAL)
m.pack(fill=BOTH, expand=1)

top = Label(m, text="top pane")
m.add(top)

bottom = Label(m, text="bottom pane")
m.add(bottom)

mainloop()


To show the 2 pane window


from Tkinter import *

m1 = PanedWindow()
m1.pack(fill=BOTH, expand=1)

left = Label(m1, text="left pane")
m1.add(left)

m2 = PanedWindow(m1, orient=VERTICAL)
m1.add(m2)

top = Label(m2, text="top pane")
m2.add(top)

bottom = Label(m2, text="bottom pane")
m2.add(bottom)

mainloop()

Output:





There are many other options which is used in this:

  • bg

  • bd

  • borderwidth

  • cursor

  • handlepad

  • height

  • orient

  • relief

  • showhandle

  • width



Tkinter Radiobutton

The Radiobutton is a standard Tkinter widget used to implement one-of-many selections..


Syntax:

w = Radiobutton ( master, option, ...  )

Here:

  • master − This represents the parent window.

  • options − Here is the list of most commonly used options for this widget.


Example:

from Tkinter import *

master = Tk()

v = IntVar()

Radiobutton(master, text="One", variable=v, value=1).pack(anchor=W)
Radiobutton(master, text="Two", variable=v, value=2).pack(anchor=W)

mainloop()

Output:






26 Views
bottom of page