Comments (6)
The "when_mouse_leaves" seems to not trigger perfectly for all widgets, so I found a (temporary?) workaround, but would still be interested in a permanent solution(or know how I could do better):
#setting up defines
def highlight(e):
for j in range(0,8):
if globals()["waffle%s" %j] != e.widget:
globals()["waffle%s" %j].enabled = False
globals()["waffle%s" %j].bg = "lightgrey"
e.widget.bg="yellow"
e.widget.enabled =True
def nohighlight(e):
e.widget.bg="lightgrey"
e.widget.enabled =False
which sets all the squares other than the newest highlighted one to disabled and applies the color light gray. So far I haven't seen it glitching.
from guizero.
We could investigate why this is happening. My gut feel says that it is probably due to events being missed as the callback is still being run. I suspect tkinter doesnt fire any events if it is busy! If this is the case there probably isnt a great deal that can be done but it would be good to know / be able to give advice in the documentation.
from guizero.
I'm investigating this. I've reproduced what @baettigp said above. It appears that two events are triggered when the mouse enters, but only one event is triggered when it leaves, which looks a bit suspicious. Run out of time now but will continue investigations.
from guizero.
I think/hope I've solved this. The issue wasn't that when_mouse_leaves
wasn't detected correctly, I think it was that two mouse enter events were being generated for each time you moused over the waffle, because when the bg colour was changed it previously destroyed and recreated the internal canvas. Have changed it to clear instead of destroy the canvas. However it's not clear whether this will have performance implications elsewhere?
from guizero.
I have merged this change in dev
from guizero.
Released in v1.4.0
from guizero.
Related Issues (20)
- Bug report - Documentation Fix HOT 3
- Bug report in documentation - Widgets - Window - Creating a Window object HOT 1
- Request to have SVG image support. HOT 1
- Slider 'end' starting parameters. HOT 4
- Mention App().tk.geometry() Functionality HOT 2
- guizero title font (not titlebox) HOT 12
- Image resizing - cannot scale the image as PIL is not available HOT 4
- Gradually Increases Memory HOT 11
- Enter key not detected in key event HOT 4
- Widgets can be given a tab order
- Color control - TextBox Background and Pushbutton HOT 1
- Destroying a container could destroy the widgets contained inside it. HOT 3
- Guizero animation importing picture into a moving oval HOT 2
- Scrollable boxes (really a box inside a scrollable canvas)
- Create right-click context menu for copy-paste with app.add_tk_widget HOT 1
- MCP3008 HOT 4
- Pillow.Image.ANTIALIAS is deprecated and will be removed HOT 1
- #Recursive call dont work in Guizero_Auto_Update HOT 6
- TextBox command HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guizero.