469,358 Members | 1,633 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

wxPython event Handling


I just started coding with wxPython. The idea is to be able to change the gui dynamically. I am trying to change the static text inside the panel after the panel is created without user input/interaction, and I am not very successful with it. Below is my codes:

Expand|Select|Wrap|Line Numbers
  1. import wx
  3. class MyForm (wx.Panel):
  4.     def __init__ (self, parent, id):
  5.         wx.Panel.__init__(self, parent, id)
  6.         self.info = wx.StaticText (self, 10, "This is my first text", wx.Point (10, 10))
  8.     def changeStaticText (self, newText):
  9.         self.info.SetLabel (newText)
  12. app = wx.PySimpleApp()
  13. frame = wx.Frame (None, -1, "Fun with wxPython")
  14. myForm = MyForm (frame, -1)
  15. frame.Show (True)
  16. app.MainLoop()
  18. # Change the text dynamically after the panel is created.
  19. myForm.changeStaticText ("NEW line of text")
Is anyone can tell me what I have done wrong here. Thanks in advance.
Mar 19 '07 #1
0 1026

Post your reply

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

Similar topics

3 posts views Thread by Robert | last post: by
7 posts views Thread by SeeBelow | last post: by
1 post views Thread by mdk.R | last post: by
5 posts views Thread by Jared Russell | last post: by
5 posts views Thread by dynamo | last post: by
4 posts views Thread by Jimmy | last post: by
16 posts views Thread by Andrea Gavana | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.