/usr/share/doc/python-pmw-doc/examples/LabeledWidget.py is in python-pmw-doc 1.3.2-6build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | title = 'Pmw.LabeledWidget demonstration'
# Import Pmw from this directory tree.
import sys
sys.path[:0] = ['../../..']
import Tkinter
import Pmw
class Demo:
def __init__(self, parent):
# Create a frame to put the LabeledWidgets into
frame = Tkinter.Frame(parent, background = 'grey90')
frame.pack(fill = 'both', expand = 1)
# Create and pack the LabeledWidgets.
column = 0
row = 0
for pos in ('n', 'nw', 'wn', 'w'):
lw = Pmw.LabeledWidget(frame,
labelpos = pos,
label_text = pos + ' label')
lw.component('hull').configure(relief='sunken', borderwidth=2)
lw.grid(column=column, row=row, padx=10, pady=10)
cw = Tkinter.Button(lw.interior(), text='child\nsite')
cw.pack(padx=10, pady=10, expand='yes', fill='both')
# Get ready for next grid position.
column = column + 1
if column == 2:
column = 0
row = row + 1
######################################################################
# Create demo in root window for testing.
if __name__ == '__main__':
root = Tkinter.Tk()
Pmw.initialise(root)
root.title(title)
widget = Demo(root)
exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
exitButton.pack()
root.mainloop()
|