[Tutor] Pygubu designer question

Dennis Lee Bieber wlfraed at ix.netcom.com
Wed Feb 2 01:06:54 EST 2022


On Tue, 1 Feb 2022 16:55:25 +0000, Alan Gauld via Tutor <tutor at python.org>
declaimed the following:

>On 01/02/2022 14:58, Dennis Lee Bieber wrote:
>
>> 	I do take exception to Mr. Gauld's statement that ALL GUIs function via
>> callbacks. 
>
>Mea culpa!
>
>In fact the original Win32 GUI API didn't include a callback mechanism
>either, you had to write an explicit event reading loop and call the
>handlers.
>

	Based upon a now quite dated book ("The Viewport Technician: A Guide to
Portable Software Design" [1988 Michael Bentley]) the original Mac OS used
an explicit polling loop; M$ Windows (1, 2, maybe 3.x) example is
(pseudo-code)

	while True:
		event = getEvent()
		translateEvent(event) #converts key events into character events
		dispatch(event)

so while the loop is explicit, the dispatch is internal "callbacks"; didn't
see an example for the Apple IIGS.

	As the subtitle indicates, the book focus is more on concerns for
writing code that is more easily ported from one system to another, and
less on the actual details of GUI/Widget code itself. {Horrors -- it even
has two whole pages on Nassi-Schneiderman charts!}

	I'm pretty certain one could write wrappers for the native GUI design
elements in which one provides an ID for each widget/event, the ID and
function (callback) get added to an internal list, and then a mainloop does
the wait for event/dispatch to function based on ID...


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/



More information about the Tutor mailing list