0

How to change the button decoration with wxPython, generally when the button is clicked, a dotted lines appear on the button.. any way to make that button not show the dotted lines?

Thanks

1
  • As satuon said, this is expected behaviour given your OS. Open any XP system widow with an OK and Cancel button and you will see it. It means that hitting the "Enter" key will press the button. Is there a particular reason that you don't want this behaviour? Do you want to force focus somewhere else? Commented Jul 6, 2012 at 8:09

2 Answers 2

1

Assuming you're running your program on Windows (you didn't say which OS, but dotted lines are used by Windows Classic look), the dotted lines are called the focus rect, and they appear to mark a button or widget as focused. They are a system setting, and your program is acting as it should - wxWidgets is meant to emulate the underlying OS default behaviour as closely as possible.


Update

I don't think you can change this behaviour from inside the program. I really doubt that wxWidgets has a setting somewhere for this, as it is OS-dependent and is the standard and correct behaviour for the Classic theme. But the focus rect is shown by default only on the Classic Look which few people use.

Try switching to Luna theme (the default on XP), and you'll see that the focus rect won't appear unless you start hitting Tab while your window is in focus. By the way, the focus rect is needed exactly for when you are switching the focus using the Tab key. You need to see where the focus is, after all. That way you know when you press Enter or Space, which button is going to be pressed. Not everyone uses only the mouse.

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

1 Comment

So is there a way to change that behaviour, i want the buttons not to show the dotted lines..is it possible?
0

You can use a custom button, for instance wx.lib.buttons.GenButton which is in pure python so you can overwrite the look, feel etc.

This also has a method SetUseFocusIndicator to turn off the dotted focus indicator

Comments

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.