wk15 | interface and application programming


Assignment :

  • make a interface for a input or output device


Download : py-file - interface design



My notes :

1 may 2014 | interface in py

In week 10 I've already started with learning how to edit a interface in py.

What I did: The original window displayed 3 colored beams, representing the 3 interval measurements form a touch sensor.
But I re-designed my board, so I wished to display 6 intervals in stead of 3.

So, first step is duplicating the content from 3 to 6 intervals.
And renaming the duplicated intervals to '4' '5' and '6'.

Now the py code will calculate 6 intervals, in stead of 3.
But, the canvas coordinates are a bit more complicated.

The windows size is limited to 600 pixels
and at the moment the coordinates of interval 4,5 & 6 are overlapping the first 3.


Book 'Programming Python' by Mark Lutz : https://www.inkling.com/read/programming-python-mark-lutz-4th/chapter-9/canvas

id = canvas.create_line(fromX, fromY, toX, toY) # line start, stop
id = canvas.create_oval(fromX, fromY, toX, toY) # two opposite box corners
id = canvas.create_arc( fromX, fromY, toX, toY) # two opposite oval corners
id = canvas.create_rectangle(fromX, fromY, toX, toY) # two opposite corners
id = canvas.create_image(250, 0, image=photo, anchor=NW) # embed a photo
id = canvas.create_window(100, 100, window=widget) # embed a widget
id = canvas.create_text(100, 280, text='Ham') # draw some text

To get all the interval visible, I've changed the coordinates of 4,5 and 6 to a lower position.
But because of the 600 pixel window limit, still not all the interval beam are visible,
because the beam itself are to thick.

So, I ended up changing all the coordinates, so all the beams are a bit smaller.
When I got the beams in the right placed, I also needed to change the coordinates of the numbers next to the beams.

The final change was editing the colors.
So the 2 sets of intervals kinda match with the colors of the wires connected to the sensors.


printscreen-py






2 may 2014 | small changes to py

For my final project I've made a network, so my touch sensor can talk directly to my servo board.
That means that the py interface is not necessary anymore.

But the py interface can still be helpful for debugging
What I changed is that now calculating the interval averages is done within my touch sensor instead of in py.

So, now if I want my touch sensor to still talk to the py interface, I add the framing back in the touch sensor file.
And start up py to see the results.