MCPcopy Index your code
hub / github.com/python/cpython / create_widgets

Method create_widgets

Lib/idlelib/help_about.py:60–147  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 self.wait_window()
59
60 def create_widgets(self):
61 frame = Frame(self, borderwidth=2, relief=SUNKEN)
62 frame_buttons = Frame(self)
63 frame_buttons.pack(side=BOTTOM, fill=X)
64 frame.pack(side=TOP, expand=True, fill=BOTH)
65 self.button_ok = Button(frame_buttons, text='Close',
66 command=self.ok)
67 self.button_ok.pack(padx=5, pady=5)
68
69 frame_background = Frame(frame, bg=self.bg)
70 frame_background.pack(expand=True, fill=BOTH)
71
72 header = Label(frame_background, text='IDLE', fg=self.fg,
73 bg=self.bg, font=('courier', 24, 'bold'))
74 header.grid(row=0, column=0, sticky=E, padx=10, pady=10)
75
76 tkpatch = self._root().getvar('tk_patchLevel')
77 ext = '.png' if tkpatch >= '8.6' else '.gif'
78 icon = os.path.join(os.path.abspath(os.path.dirname(__file__)),
79 'Icons', f'idle_48{ext}')
80 self.icon_image = PhotoImage(master=self._root(), file=icon)
81 logo = Label(frame_background, image=self.icon_image, bg=self.bg)
82 logo.grid(row=0, column=0, sticky=W, rowspan=2, padx=10, pady=10)
83
84 byline_text = "Python's Integrated Development\nand Learning Environment" + 5*'\n'
85 byline = Label(frame_background, text=byline_text, justify=LEFT,
86 fg=self.fg, bg=self.bg)
87 byline.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5)
88
89 forums_url = "https://discuss.python.org"
90 forums = Button(frame_background, text='Python (and IDLE) Discussion', width=35,
91 highlightbackground=self.bg,
92 command=lambda: webbrowser.open(forums_url))
93 forums.grid(row=6, column=0, sticky=W, padx=10, pady=10)
94
95
96 docs_url = ("https://docs.python.org/%d.%d/library/idle.html" %
97 sys.version_info[:2])
98 docs = Button(frame_background, text='IDLE Documentation', width=35,
99 highlightbackground=self.bg,
100 command=lambda: webbrowser.open(docs_url))
101 docs.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=10)
102
103
104 Frame(frame_background, borderwidth=1, relief=SUNKEN,
105 height=2, bg=self.bg).grid(row=8, column=0, sticky=EW,
106 columnspan=3, padx=5, pady=5)
107
108 tclver = str(self.info_patchlevel())
109 tkver = ' and ' + tkpatch if tkpatch != tclver else ''
110 versions = f"Python {pyver} with tcl/tk {tclver}{tkver}"
111 vers = Label(frame_background, text=versions, fg=self.fg, bg=self.bg)
112 vers.grid(row=9, column=0, sticky=W, padx=10, pady=0)
113 py_buttons = Frame(frame_background, bg=self.bg)
114 py_buttons.grid(row=10, column=0, columnspan=2, sticky=NSEW)
115 self.py_license = Button(py_buttons, text='License', width=8,
116 highlightbackground=self.bg,
117 command=self.show_py_license)

Callers 1

__init__Method · 0.95

Calls 14

FrameClass · 0.90
ButtonClass · 0.90
LabelClass · 0.90
PhotoImageClass · 0.90
strFunction · 0.85
_rootMethod · 0.80
info_patchlevelMethod · 0.80
packMethod · 0.45
gridMethod · 0.45
getvarMethod · 0.45
joinMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected