[Tkinter-discuss] Where is place for "Events" in an OOP script?

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 6 04:10:50 CEST 2011


On 06/10/11 05:26, GKalman wrote:
> (1) Do the actions
> defined thru the "bindings" and associated callback-functions "belong" to the
> Spring class or the GUI class?

The functions bound directly to input events such as mouse clicks
and movements should probably be part of the GUI. You will probably
want to perform some processing on them before doing anything to
the model, such as transforming from pixel coordinates to model
space coordinates and maybe other things.

> (2)Should there be a separate "Actions" class
> that ties the Spring (non-GUI) class and the DisplayBoard (GUI) class together?

That's hard to answer without knowing a lot more details about
the application. Use one if it helps, but don't feel obliged to
include one if it doesn't seem to be adding any value.

-- 
Greg


More information about the Tkinter-discuss mailing list