Giter Site home page Giter Site logo

Comments (6)

baettigp avatar baettigp commented on July 27, 2024

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.

martinohanlon avatar martinohanlon commented on July 27, 2024

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.

lawsie avatar lawsie commented on July 27, 2024

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.

lawsie avatar lawsie commented on July 27, 2024

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.

martinohanlon avatar martinohanlon commented on July 27, 2024

I have merged this change in dev

from guizero.

martinohanlon avatar martinohanlon commented on July 27, 2024

Released in v1.4.0

from guizero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.