0

I am working on a wxPython app where I have a button with label text 'Allocate'. Additionally I also have 2 radio options on my app namely 'UnAllocated' and 'Allocated'. When the app launches by default the radio option 'UnAllocated' is selected and the button has label text as 'Allocate'. I have made event driven code to change the label text of the button from 'Allocate' to 'Re-Allocate' upon selecting the radio option 'Allocated'. Uptill now everything is fine and code works as intended.

Now the problem is in the event of radio option 'Allocated' the button label does gets a new label text as 'Re-Allocate' however it is overwriting the previous label text instead of changing. Then as soon as I bring my mouse cursor on the button the text gets refreshed and appears clean and clear. Below is my Code

def rdoAllocated_Click(self, event):
    self.btn_Allocate.SetLabelText('Re-Allocate')

def rdoUnAllocated_Click(self, event):
    self.btn_Allocate.SetLabelText('Allocate')

is there a way of refreshing the button label text automatically after the change to display clearly the new text instead of unreadable overwritten text. Here is the image how it looks when getting updated

1 Answer 1

1

Try calling self.btn_Allocate.Refresh() This can happen sometimes, depending on platform and widget types. The Refresh simply tells the system to send a paint event in the near future, and will most-likely take care of the problem for you. If not then you may need to call the parent window's Refresh instead.

Sign up to request clarification or add additional context in comments.

1 Comment

perfect. Thank you so much Robin :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.