Skip to content

A race condition can result in the error: 'NoneType' object has no attribute 'geometry' #114

@f34rdotcom

Description

@f34rdotcom
  • Line
    self._canvas.update()
  • Version
    ttkwidgets Version: 0.13.0
  • Issue
    self._canvas.update() can cause any pending events to be called including _on_leave() event. This will result in self._top_level being reset to None and then the .geometry) call to fail
  • partial call stack
  File "ttkwidgets/frames/tooltip.py", line 177, in config
  File "ttkwidgets/frames/tooltip.py", line 125, in show
AttributeError: 'NoneType' object has no attribute 'geometry'

  • proposed fix
            x, y = self.master.winfo_pointerxy()
        self._canvas.update()
        # .update() allows background tasks to run could cause on_leave to reset _toplevel to None
        if self._toplevel:
            # Update the Geometry of the Toplevel to update its position and size
            self._toplevel.geometry("{0}x{1}+{2}+{3}".format(
                self._canvas.winfo_width(), self._canvas.winfo_height(),
                x + self.__offset[0], y + self.__offset[1]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions