[Pythonmac-SIG] Widget demos from the PythonIDE

Just van Rossum just@letterror.com
Mon, 23 Aug 1999 10:59:25 +0200


At 10:17 AM +0200 8/23/99, Pieter Claerhout wrote:
>Hello,
>
>is it possible to use the widgets from the PythonIDE outside the
>IDE or can they only be used inside the IDE?
>
>When I try to run one of the widget demo scripts by double-
>clicking them in the Finder, then I get an error which tells me
>that a resource cannot be found?

That's right. And once you've figured out which how to solve that it still
won't work, since those demos require an even loop, or more specifically, a
Wapplication.Application instance to be active. I've appended a minimal
version of such an app. It's a bit weird, but that comes from the fact that
W was originally designed to make app extension easy (mostly "add a new
kind of window"), not application development itself (I only use it in 2
apps: the IDE itself and a customized font editor).

Just


"""Minimal W application."""

import Wapplication

class TestApp(Wapplication.Application):

	def __init__(self):
		import Res
		Res.FSpOpenResFile("Widgets.rsrc", 1)
		self._menustocheck = []
		self.preffilepath = ":Python:PythonIDE preferences"
		Wapplication.Application.__init__(self, 'Pyth')
		# open a new text editor
		import PyEdit
		PyEdit.Editor()
		# start the mainloop
		self.mainloop()


TestApp()