kxgames / glooey

An object-oriented GUI library for pyglet.
MIT License
91 stars 6 forks source link

Text Input bugging out the ScrollBox #40

Closed PSMusicalRoc closed 4 years ago

PSMusicalRoc commented 4 years ago

I've been making my own widget for a program I've been making, shown below:

cell

The idea is that on the left is a Text Input widget I've made from a Form, and on the right is a custom widget derived from a ScrollBox that contains a Grid filled with Images. This has been achieved, as shown in the picture (although the Text Input will be scaled down significantly by the end of the creation.)

Right now, however, I'm getting a strange warning from Python. It only happens when I:

  1. Click into the Text Input, then
  2. Without unfocusing the Text Input, click any part of the Scrollbar

This causes the following error message (adapted for whichever part of the scrollbar I clicked): glooey.helpers.UsageError: Forward(id=1700) is already grabbing the mouse, Forward(id=1700) can't grab it.

If I click the Grip, nothing of note happens other than the message in the console. However, pushing either the up/down buttons will lock those buttons in the pressed position, and the ScrollBox will continue to move in whichever direction the button was corresponding to.

Is there something I'm doing wrong? Here's my class, for reference:

class CharacterSelect(glooey.Stack):
  def __init__(self, position):
    super().__init__()

    self.x = position[0]
    self.y = position[1]
    # Slot() is a custom Background() that I've defined
    self.add_back(Slot())

    self.hbox = self.HBox()

    # Create Left Side of Character Select
    self.left = self.VBox()
    self.left.add(TextInput())

    # Create Right Side of the widget
    self.right = ScrollBox()
    self.right.set_height_hint(Globals._important_vars['window'].get_size()[0]/6 - 10)
    self.grid = Grid()

""" This section just references a function not defined in this snippet that returns a
    list of images to be put in the right part of the widget.
    row = 0
    col = 0
    for image in importCharacterButtonImages("Bayonetta"):
      self.grid[row, col] = glooey.Image(image)
      col += 1
      if col >= 2:
        row += 1
        col = 0
"""

    self.right.add(self.grid)

    self.hbox.add(self.left, 'expand')
    self.hbox.add(self.right, 'expand')

    self.add_front(self.hbox)

  class HBox(glooey.HBox):
    custom_cell_padding = 5

  class VBox(glooey.VBox):
    custom_cell_padding = 5
kalekundert commented 4 years ago

Thanks for the bug report! I think this is most likely a bug in glooey, so I'll try to look into it ASAP.

PSMusicalRoc commented 4 years ago

Interesting... is there anything I can do to help track down this bug while I'm waiting?

kalekundert commented 4 years ago

It was a bug it glooey, but I'm pretty sure it's fixed now. Let me know if you run into any other issues!

PSMusicalRoc commented 4 years ago

It seems to work now, thanks!