Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Extend ImageMap to Canvas #447
The ImageMap is actually quite a simple piece of code.
You could create one on a canvas with very little effort:
def click(event): print(event.x, event.y) with gui("Canvas Click", "400x400") as app: app.addCanvas("c1").bind("<Button-1>", click)
Then you can have a loop through a set of coordinates, or just a few IF statements to determine where on the canvas was clicked....
I actually extended your base. It could probably be optimized, but it works for now.
added a commit
May 1, 2018
And BTW I am having a great time working with your framework. It really makes UI development relatively painless.
Would like to see more of those generic types of functions, like you are considering in your refactoring.
Having to qualify the specific widget (Entry, SpinBox, ListBox (List?)...) in a modifier like app.enableEntryTooltip(control) is a bit heavy handed. Since you know all the widgets by control name and their types, you should be able to apply that without a specific widget qualifier. app.enableTooltip(control) should be sufficient.
On the other hand, having to list out the widget type prevents confusion in coding and enhances the awareness of functional capabilities for your students.
I guess another way to approach it might be
The world is your oyster.
Keep up the good work!