in all my research everyone is saying that pressing tab by default gets u to the next textctrl, but when i try to do that, i get the error sound "ting", and it doesn't, what is a way to have the tab navigate through textctrls?
another thing is that the cursor is not on the first textctrl by default, is there a way to set it in the Frame?
thank you all
T
3 2101
I feel that it might be easier to help you if you can show us some example code.
-
def addLocationEvent(event):
-
-
global addLocationDlg
-
addLocationDlg = wx.Frame(loginFrame, -1, "Add Location", size=(450, 550), style=wx.DEFAULT_DIALOG_STYLE)
-
-
addLocationDlg.SetBackgroundColour("")
-
#TextBox
-
targetTX = wx.StaticText(addLocationDlg ,-1,"Enter Location Information:", pos = (20,20))
-
-
-
global ownerTF
-
ownerTF = wx.TextCtrl(addLocationDlg,-1,"", (150,270),size =(180,20),style = wx.TE_LEFT | wx.TE_PROCESS_TAB)
-
-
addPhotoBT = wx.Button(addLocationDlg,-1,'Browse',pos = (220,365), size = (60,30))
-
addPhotoBT.Bind(wx.EVT_BUTTON,pickPhotoEvent,addPhotoBT)
-
-
global photoAddressTF
-
photoAddressTF = wx.TextCtrl(addLocationDlg,-1,"", (20,370),size =(180,20),style = wx.TE_LEFT)
-
-
-
-
addLocationBT = wx.Button(addLocationDlg,-1,'-Add-',pos = (20,410), size = (50,50))
-
addLocationBT.Bind(wx.EVT_BUTTON,addLocEvent,addLocationBT)
-
-
addLocationDlg.Show(True)
-
-
it's just a traditional old dialog, nothing too special about it, and the problem also exists in frames not only dialogues
please help?
thanks
I'm not entirely positive but I think this has much to do with your other question about classes. And it makes it a little difficult to answer your question. Take a look at this code and I think you will understand the differences.
Note this isn't perfect code (what is really?) but it should suffice as an example.
I hope it helps! -
import wx
-
-
class AddLocationDlg(wx.Dialog):
-
def __init__(self, parent, ID, title, pos=wx.DefaultPosition,
-
size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE):
-
# Init the dialog class
-
wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
-
-
# Init our controls, note global is replaced by naming objects
-
# with 'self.', also the parent argument is 'self' as opposed to
-
# 'AddLocationDlg'
-
self.SetBackgroundColour("")
-
targetTX = wx.StaticText(self ,-1,"Enter Location Information:",
-
pos=(20,20))
-
self.ownerTF = wx.TextCtrl(self, -1, "", (150,270), size=(180, 20),
-
style=wx.TE_LEFT | wx.TE_PROCESS_TAB)
-
self.photoAddressTF = wx.TextCtrl(self, -1, "", (20, 370),
-
size=(180,20), style=wx.TE_LEFT)
-
self.addPhotoBT = wx.Button(self, -1, 'Browse', pos =(220, 365),
-
size=(60,30))
-
self.addLocationBT = wx.Button(self, -1, '-Add-', pos=(20,410),
-
size=(50,50))
-
self.Bind(wx.EVT_BUTTON, self.OnButton)
-
-
def OnButton(self, event):
-
# Handle Button events for the dialog here.
-
pass
-
-
class MainFrame(wx.Frame):
-
def __init__(self, parent, ID, title, pos=wx.DefaultPosition, \
-
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
-
# Init the frame class
-
wx.Frame.__init__(self, parent, ID, title, pos, size, style)
-
-
# Create a button and bind the event.
-
self.btn = wx.Button(self, -1, "Show Dialog!")
-
self.Bind(wx.EVT_BUTTON, self.OnButton)
-
-
def OnButton(self, event):
-
# If the ID of the button causing the event is the ID of
-
# self.btn, then show the dialog.
-
if event.GetId() == self.btn.GetId():
-
self.addLocationEvent()
-
-
def addLocationEvent(self):
-
dlg = AddLocationDlg(self, -1, "Add Location", size=(450, 550))
-
dlg.Show()
-
-
if __name__ == "__main__":
-
app = wx.App()
-
mainframe = MainFrame(None, -1, "Test", size=(225, 200))
-
mainframe.Show()
-
app.MainLoop()
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Logan |
last post by:
I asked a similar question already in the wxPython mailing list,
but did not get an answer up to now:
1.) When using a TextCtrl with styles (color etc.) in wxPython,
is it then possible to get a...
|
by: Hako |
last post by:
Hello All,
I have a function to set readonly or editable of a textctrl. I'd like
to make the textctrl initial set readonly and use other event funciton
to set editable of the textctrl but it...
|
by: Simon Hibbs |
last post by:
I have a simple form with some input values and some calculated values
in TextCtrl widgets.
What I would like to do is have the display update automaticaly when
the user changes one of the input...
|
by: abcd |
last post by:
I have a TextCtrl which is set to be multi-line. I have a function
say, updateText(msg), which takes some string and appends it to the
text control...
txtControl.AppendText(msg)
...
|
by: citronelu |
last post by:
I made a small wxPython app that retrieves web data; for visual
logging I use a TextCtrl widget, and stdout is redirected to it,
something like this:
class RedirectOutput:
def __init__(self,...
|
by: Doug Bell |
last post by:
Hi
I have a DataGrid with some hidden columns and also some read Only and some
ComboBox Columns.
Sandard Tabbing through the Datagrid sees the focus go to the hidden columns
requiring further...
|
by: bcwhite |
last post by:
I'm running Python2.5 with wxPython v2.8.3.0 under WinXP and I cannot
get the SetDefaultStyle method to work.
I'm trying:
self.output.SetDefaultStyle(wx.TextAttr(wx.RED))...
|
by: Alejandro |
last post by:
Hi:
I want to redirect stdout to a textctrl I have. From what I read in
the wxpython documentation, I can use the wxLogTextCtrl class to do
this. I am doing the following:
class...
|
by: aeroumr |
last post by:
In the following code, I have created a panel with a button and a textctrl object on it. I have also created a menubar that will create a new text file (i.e. textctrl object). My problem is that...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |