MyreMylar / pygame_gui

A GUI system for pygame.
MIT License
698 stars 83 forks source link

set_text_hidden function of UITextEntryLine does not hide already entered symbols #392

Closed shdshdw closed 1 year ago

shdshdw commented 1 year ago

Describe the bug When calling set_text_hidden(True) on a non-empty UITextEntryLine component it will not update already entered text to become hidden, instead only newly entered symbols will be hidden.

To Reproduce Steps to reproduce the behaviour:

  1. Add a new UITextEntryLine component to the UIManager
  2. Create a button which executes set_text_hidden(True)
  3. Enter text in UITextEntryLine
  4. Press button to hide text

Expected behaviour I expect already typed text to become hidden by displaying the '●' character instead. In reality only newly typed characters will become hidden.

Screenshots Example Button code:

         for event in pygame.event.get():

             if event.type == pygame_gui.UI_BUTTON_PRESSED:                     

                 if event.ui_element == self.visibility_button:

                    self.visibility_button.disable()
                    self.visibility_button.hide()
                    self.hidden_button.enable()
                    self.hidden_button.show()
                    self.input_password.set_text_hidden(False)

                if event.ui_element == self.hidden_button:

                    self.hidden_button.disable()
                    self.hidden_button.hide()
                    self.visibility_button.enable()
                    self.visibility_button.show()
                    self.input_password.set_text_hidden(True)

Platform and software:

MyreMylar commented 1 year ago

this was just one tab too many.

Cheers for the bug report!