Reputation: 1
I don't know whether wxpython is the problem or my code, but the label always catches focus if I want to start my code. Even clicking somewhere else won't let go, and it is still focused.
here is my Python code:
import wx
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Encrypto++", size=(950, 600))
panel = wx.Panel(frame)
Key_box = wx.TextCtrl(panel, pos=(40, 50), size=(500, 45))
frame.Show()
app.MainLoop()
I tried testing out more Labels but still had no success, chatgpt couldn't help me more.
Upvotes: 0
Views: 42
Reputation: 33111
A wx.TextCtrl
is a not a label. It is a widget that allows the user to enter text. Since it is the only widget in your panel, it received focus by default.
If you want to display text that the user cannot edit, you should use wx.StaticText
instead. Here's a link to the documentation
Upvotes: 1
Reputation: 1
usually the focus should always be visible but it can easily be manipulated
import wx
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Encrypto++", size=(950, 600))
panel = wx.Panel(frame)
Key_box = wx.TextCtrl(panel, pos=(40, 50), size=(500, 45))
panel.SetFocusIgnoringChildren()
frame.Show()
app.MainLoop()
Upvotes: 0