Creates and packs the various widgets. Why is it that GUI code always ends up looking a mess, despite all the best intentions to keep it tidy? Answers on a postcard, please.
(self)
| 286 | self.stopGoButton['state'] = tk.NORMAL |
| 287 | |
| 288 | def createWidgets(self): |
| 289 | """Creates and packs the various widgets. |
| 290 | |
| 291 | Why is it that GUI code always ends up looking a mess, despite all the |
| 292 | best intentions to keep it tidy? Answers on a postcard, please. |
| 293 | """ |
| 294 | # Status bar |
| 295 | statusFrame = tk.Frame(self.top, relief=tk.SUNKEN, borderwidth=2) |
| 296 | statusFrame.pack(anchor=tk.SW, fill=tk.X, side=tk.BOTTOM) |
| 297 | tk.Label(statusFrame, width=1, textvariable=self.statusVar).pack(side=tk.TOP, fill=tk.X) |
| 298 | |
| 299 | # Area to enter name of test to run |
| 300 | leftFrame = tk.Frame(self.top, borderwidth=3) |
| 301 | leftFrame.pack(fill=tk.BOTH, side=tk.LEFT, anchor=tk.NW, expand=1) |
| 302 | suiteNameFrame = tk.Frame(leftFrame, borderwidth=3) |
| 303 | suiteNameFrame.pack(fill=tk.X) |
| 304 | |
| 305 | # Progress bar |
| 306 | progressFrame = tk.Frame(leftFrame, relief=tk.GROOVE, borderwidth=2) |
| 307 | progressFrame.pack(fill=tk.X, expand=0, anchor=tk.NW) |
| 308 | tk.Label(progressFrame, text="Progress:").pack(anchor=tk.W) |
| 309 | self.progressBar = ProgressBar(progressFrame, relief=tk.SUNKEN, |
| 310 | borderwidth=2) |
| 311 | self.progressBar.pack(fill=tk.X, expand=1) |
| 312 | |
| 313 | |
| 314 | # Area with buttons to start/stop tests and quit |
| 315 | buttonFrame = tk.Frame(self.top, borderwidth=3) |
| 316 | buttonFrame.pack(side=tk.LEFT, anchor=tk.NW, fill=tk.Y) |
| 317 | |
| 318 | tk.Button(buttonFrame, text="Discover Tests", |
| 319 | command=self.discoverClicked).pack(fill=tk.X) |
| 320 | |
| 321 | |
| 322 | self.stopGoButton = tk.Button(buttonFrame, text="Start", |
| 323 | command=self.runClicked, state=tk.DISABLED) |
| 324 | self.stopGoButton.pack(fill=tk.X) |
| 325 | |
| 326 | tk.Button(buttonFrame, text="Close", |
| 327 | command=self.top.quit).pack(side=tk.BOTTOM, fill=tk.X) |
| 328 | tk.Button(buttonFrame, text="Settings", |
| 329 | command=self.settingsClicked).pack(side=tk.BOTTOM, fill=tk.X) |
| 330 | |
| 331 | # Area with labels reporting results |
| 332 | for label, var in (('Run:', self.runCountVar), |
| 333 | ('Failures:', self.failCountVar), |
| 334 | ('Errors:', self.errorCountVar), |
| 335 | ('Skipped:', self.skipCountVar), |
| 336 | ('Expected Failures:', self.expectFailCountVar), |
| 337 | ('Remaining:', self.remainingCountVar), |
| 338 | ): |
| 339 | tk.Label(progressFrame, text=label).pack(side=tk.LEFT) |
| 340 | tk.Label(progressFrame, textvariable=var, |
| 341 | foreground="blue").pack(side=tk.LEFT, fill=tk.X, |
| 342 | expand=1, anchor=tk.W) |
| 343 | |
| 344 | # List box showing errors and failures |
| 345 | tk.Label(leftFrame, text="Failures and errors:").pack(anchor=tk.W) |
no test coverage detected