Question

I am trying to implement a simple application. It use wx.FileDialog to select a file, then display the file name in a wx.TextCtrl component.

It works allright at first, the file name was displayed as expected. However, when the mouse move over the text control component, the contents are gone.

Here is my code:

fdlg_input_dir = wx.FileDialog(dlg_input, "Choose input file", os.getcwd(), "", "All files(*.*)|*.*", wx.OPEN)

fdlg_input_dir.ShowModal()

textctrl_input_dir = wx.TextCtrl(dlg_input, 5, fdlg_input_dir.GetPath(), size=(300,20), pos=(85,20))

So my questions is, how to remain the contents in the TextCtrl component while the mouse moves over it?

Any suggestions are appreciated. Thanks.

Was it helpful?

Solution

Problem solved. It turns out that the initial text in the control component doesn't stand. Instead, using following code should archieve what I expected:

textctrl_input_dir.write(fdlg_input_dir.GetPath())
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top