def aligngrouptags(groups
):
# Adjust the y position of the tags in /groups/ so that they all
# have the height of the highest tag.
height
= (string
.atoi(str(group
._ring
.cget('borderwidth'))) +
string
.atoi(str(group
._ring
.cget('highlightthickness'))))
height
= group
._tag
.winfo_reqheight()
if maxTagHeight
< height
:
ringBorder
= (string
.atoi(str(group
._ring
.cget('borderwidth'))) +
string
.atoi(str(group
._ring
.cget('highlightthickness'))))
topBorder
= maxTagHeight
/ 2 - ringBorder
/ 2
group
._hull
.grid_rowconfigure(0, minsize
= topBorder
)
group
._ring
.grid_rowconfigure(0,
minsize
= maxTagHeight
- topBorder
- ringBorder
)
if group
._tag
is not None:
group
._tag
.place(y
= maxTagHeight
/ 2)
class Group( Pmw
.MegaWidget
):
def __init__(self
, parent
= None, **kw
):
# Define the megawidget options.
('collapsedsize', 6, INITOPT
),
('ring_borderwidth', 2, None),
('ring_relief', 'groove', None),
('tagindent', 10, INITOPT
),
self
.defineoptions(kw
, optiondefs
)
# Initialise the base class (after defining the options).
Pmw
.MegaWidget
.__init
__(self
, parent
)
interior
= Pmw
.MegaWidget
.interior(self
)
self
._ring
= self
.createcomponent(
Tkinter
.Frame
, (interior
,),
self
._groupChildSite
= self
.createcomponent(
Tkinter
.Frame
, (self
._ring
,)
self
._tag
= self
.createcomponent(
Tkinter
.Label
, (interior
,),
ringBorder
= (string
.atoi(str(self
._ring
.cget('borderwidth'))) +
string
.atoi(str(self
._ring
.cget('highlightthickness'))))
tagHeight
= self
._tag
.winfo_reqheight()
x
= ringBorder
+ self
['tagindent'],
topBorder
= tagHeight
/ 2 - ringBorder
/ 2
self
._ring
.grid(column
= 0, row
= 1, sticky
= 'nsew')
interior
.grid_columnconfigure(0, weight
= 1)
interior
.grid_rowconfigure(1, weight
= 1)
interior
.grid_rowconfigure(0, minsize
= topBorder
)
self
._groupChildSite
.grid(column
= 0, row
= 1, sticky
= 'nsew')
self
._ring
.grid_columnconfigure(0, weight
= 1)
self
._ring
.grid_rowconfigure(1, weight
= 1)
self
._ring
.grid_rowconfigure(0,
minsize
= tagHeight
- topBorder
- ringBorder
)
# Check keywords and initialise options.
self
.showing
= not self
.showing
self
._groupChildSite
.grid(column
= 0, row
= 1, sticky
= 'nsew')
self
._groupChildSite
.grid_forget()
tagHeight
= self
._tag
.winfo_reqheight()
self
._ring
.configure(height
=(tagHeight
/ 2) + self
['collapsedsize'])
return self
._groupChildSite