Design Question. Data Acquisition/Display related.
StepH
stephane.bronsart at teledisnet.be
Tue May 17 10:28:44 EDT 2005
Alex Verstraeten a écrit :
> StepH wrote:
>
>> 1./ Is each "display" must responsible to acquire/read the data ?
>> 2./ Or an engine collect the data then send them to each "display" ?
>>
>>
>>
> I'd keep it simple:
>
> - DataCollector class
> asociated with one or more display instances (implemented as a list of
> display subscribers)
> it collects data from a source and notifies each subscribed display
> that new data is available.
> could something like a 'collect' method which performs:
>
> for display in self.subscribed_displays:
> display.update( data )
>
>
> - Display class
> just a simple display class with an "update" method
> it should be able to receive new data
> and display new data
> (those 2 actions could be implemented in different methods, you might
> not want to display everytime new data is available... maybe you might
> want to consolidate data in some way and output it at some high interval)
Ok, it was my first idea too...
>
>> Also, how to "anim" this ?
>>
>> 1./ Via a timer ?
>> 2./ Via a simple loop (read/update display/pause/read user key)
>>
>>
>
> a simple loop could do it
> - handle user events
> - collect data
> - update displays
> - sleep
>
>
>
Here i've a prob. (due to the fact that I start both with Python &
TkInter). In TkInter, you run your app by launching a mainloop()
routine, right ? So, how, in my forever loop (handle user events /
Collect data / Update Display / Sleep) handle the user data ?
Sure, i can (i suppose), log user activity (via the event send by the Tk
underlayer), the "poll" theses event in my for ever loop ? But in this
case, are these event will be correctly generated (by Tk) ? How to
"give the hand" to Tk in such scenario ?
Thanks for your help.
StepH.
More information about the Python-list
mailing list