473,396 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

tabbing between textctrl's

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
Sep 20 '09 #1
3 2101
I feel that it might be easier to help you if you can show us some example code.
Sep 20 '09 #2
Expand|Select|Wrap|Line Numbers
  1. def addLocationEvent(event):
  2.  
  3.     global addLocationDlg
  4.     addLocationDlg = wx.Frame(loginFrame, -1, "Add Location", size=(450, 550), style=wx.DEFAULT_DIALOG_STYLE)        
  5.  
  6.     addLocationDlg.SetBackgroundColour("")
  7.     #TextBox 
  8.     targetTX = wx.StaticText(addLocationDlg ,-1,"Enter Location Information:", pos = (20,20))
  9.  
  10.  
  11.     global ownerTF
  12.     ownerTF = wx.TextCtrl(addLocationDlg,-1,"", (150,270),size =(180,20),style = wx.TE_LEFT | wx.TE_PROCESS_TAB)
  13.  
  14.     addPhotoBT = wx.Button(addLocationDlg,-1,'Browse',pos = (220,365), size = (60,30))
  15.     addPhotoBT.Bind(wx.EVT_BUTTON,pickPhotoEvent,addPhotoBT)
  16.  
  17.     global photoAddressTF
  18.     photoAddressTF = wx.TextCtrl(addLocationDlg,-1,"", (20,370),size =(180,20),style = wx.TE_LEFT)
  19.  
  20.  
  21.  
  22.     addLocationBT = wx.Button(addLocationDlg,-1,'-Add-',pos = (20,410), size = (50,50))
  23.     addLocationBT.Bind(wx.EVT_BUTTON,addLocEvent,addLocationBT)
  24.  
  25.     addLocationDlg.Show(True)
  26.  
  27.  


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
Sep 20 '09 #3
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!

Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. class AddLocationDlg(wx.Dialog):
  4.     def __init__(self, parent, ID, title, pos=wx.DefaultPosition,
  5.                  size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE):
  6.         # Init the dialog class
  7.         wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
  8.  
  9.         # Init our controls, note global is replaced by naming objects
  10.         # with 'self.', also the parent argument is 'self' as opposed to
  11.         # 'AddLocationDlg'
  12.         self.SetBackgroundColour("")
  13.         targetTX = wx.StaticText(self ,-1,"Enter Location Information:",
  14.                                  pos=(20,20))
  15.         self.ownerTF = wx.TextCtrl(self, -1, "", (150,270), size=(180, 20),
  16.                                    style=wx.TE_LEFT | wx.TE_PROCESS_TAB)
  17.         self.photoAddressTF = wx.TextCtrl(self, -1, "", (20, 370),
  18.                                           size=(180,20), style=wx.TE_LEFT)
  19.         self.addPhotoBT = wx.Button(self, -1, 'Browse', pos =(220, 365),
  20.                                     size=(60,30)) 
  21.         self.addLocationBT = wx.Button(self, -1, '-Add-', pos=(20,410),
  22.                                        size=(50,50))
  23.         self.Bind(wx.EVT_BUTTON, self.OnButton)
  24.  
  25.     def OnButton(self, event):
  26.         # Handle Button events for the dialog here.
  27.         pass
  28.  
  29. class MainFrame(wx.Frame):
  30.     def __init__(self, parent, ID, title, pos=wx.DefaultPosition, \
  31.                  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
  32.         # Init the frame class
  33.         wx.Frame.__init__(self, parent, ID, title, pos, size, style)
  34.  
  35.         # Create a button and bind the event.
  36.         self.btn = wx.Button(self, -1, "Show Dialog!")
  37.         self.Bind(wx.EVT_BUTTON, self.OnButton)
  38.  
  39.     def OnButton(self, event):
  40.         # If the ID of the button causing the event is the ID of
  41.         # self.btn, then show the dialog.
  42.         if event.GetId() == self.btn.GetId():
  43.             self.addLocationEvent()
  44.  
  45.     def addLocationEvent(self):
  46.         dlg = AddLocationDlg(self, -1, "Add Location", size=(450, 550))
  47.         dlg.Show()
  48.  
  49. if __name__ == "__main__":
  50.     app = wx.App()
  51.     mainframe = MainFrame(None, -1, "Test", size=(225, 200))
  52.     mainframe.Show()
  53.     app.MainLoop()
  54.  
Sep 20 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
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...
6
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...
12
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...
10
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) ...
5
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,...
6
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...
3
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))...
3
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...
1
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...
0
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
0
BarryA
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.