473,399 Members | 3,038 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,399 software developers and data experts.

WXpython Question

I try to reach a specific wx StaticText element's text and to change
it by clicking on a button
now let's say the this is my element:

wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE)
And this is my EVT_BUTTON bind function :

def OnClick(event):

which code shude i enter to change "hello" to "goodbay"?

thanks
Jun 27 '08 #1
3 1094
On May 23, 8:24*am, Gandalf <goldn...@gmail.comwrote:
I try to reach a specific wx StaticText element's text and to change
it by clicking on a button

now let's say the this is my element:

wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE)

And this is my EVT_BUTTON bind function :

def OnClick(event):

which code shude i enter to change "hello" to "goodbay"?

thanks

You're probably looking for SetLabel(). So if you do something like
this to instantiate the StaticText:

self.myText = wx.StaticText(panel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN_CENTRE)

Then you can change your text by adding this to your OnClick event
handler:

self.myText.SetLabel("goodbye")

Have fun! And remember, there's a great wxPython mailing list too:

http://www.wxpython.org/maillist.php

Mike
Jun 27 '08 #2
On May 23, 3:29 pm, Mike Driscoll <kyoso...@gmail.comwrote:
On May 23, 8:24 am, Gandalf <goldn...@gmail.comwrote:
I try to reach a specific wx StaticText element's text and to change
it by clicking on a button
now let's say the this is my element:
wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE)
And this is my EVT_BUTTON bind function :
def OnClick(event):
which code shude i enter to change "hello" to "goodbay"?
thanks

You're probably looking for SetLabel(). So if you do something like
this to instantiate the StaticText:

self.myText = wx.StaticText(panel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN_CENTRE)

Then you can change your text by adding this to your OnClick event
handler:

self.myText.SetLabel("goodbye")

Have fun! And remember, there's a great wxPython mailing list too:

http://www.wxpython.org/maillist.php

Mike
Thanks!
Jun 27 '08 #3
On Fri, 23 May 2008 06:40:13 -0700 (PDT), Gandalf <go******@gmail.com>
wrote:
>On May 23, 3:29 pm, Mike Driscoll <kyoso...@gmail.comwrote:
>On May 23, 8:24 am, Gandalf <goldn...@gmail.comwrote:
I try to reach a specific wx StaticText element's text and to change
it by clicking on a button
now let's say the this is my element:
wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE)
And this is my EVT_BUTTON bind function :
def OnClick(event):
which code shude i enter to change "hello" to "goodbay"?
thanks

You're probably looking for SetLabel(). So if you do something like
this to instantiate the StaticText:

self.myText = wx.StaticText(panel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN_CENTRE)

Then you can change your text by adding this to your OnClick event
handler:

self.myText.SetLabel("goodbye")

Have fun! And remember, there's a great wxPython mailing list too:

http://www.wxpython.org/maillist.php

Mike

Thanks!
You should also note

docs.wxwidgets.org

(I tend to find that by googling "wxTreeCtrl" or whatever.)
The descriptions of various components there are more
complete than in the (excellent!) wxPython book - it's
C++ but usually not hard to figure out what the corresponding
wxPython should be.

David C. Ullrich
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anand | last post by:
I am calling a python script from LabVIEW. This is achieved by making a dll call to python22.dll. It works perfectly well for most of my code. I now want to throwup dialog boxes from python. It...
3
by: Equis Uno | last post by:
Hi, I'm trying to run some Python software I downloaded off of sf.net. It's called Boa. It uses wxPython. It appears my install of Python cannot see my install of wxPython.
8
by: Erik Johnson | last post by:
I am looking for some input on GUI libraries. I want to build a Python-driven GUI, but don't really understand the playing field very well. I have generally heard good things about wxPython. I...
14
by: Rod W | last post by:
I'm just starting out on Python but my primary goal is to provide applications with some user interface (GUI). Can someone point me to a good comparison of whether I should use wxPython (with...
4
by: KvS | last post by:
Hi all, I'm pretty new to (wx)Python so plz. don't shoot me if I've missed something obvious ;). I have a panel inside a frame, on which a Button and a StaticText is placed: self.panel =...
2
by: OpenPavilion | last post by:
Hello, did anyone succeed in combining wxpython and a 3d engine (pyogre, crystalblend, panda3d, soya etc.) ? I would like to create an application, which uses wxpython tree, menu and grid...
1
by: Steven W. Orr | last post by:
python-2.3.5 wx-2.6 I just bought the wxPython In Action book and I see that all the examples say to import wx All of our pre-existing code was horribly doing a from wxPython import * I...
4
by: python | last post by:
I'm looking at rewriting some legacy VB applications and am pondering which of the following techniques to use: 1. Browser based GUI with local web server (Browser + wsgiref.simple_server) (I'm...
3
by: mistersulu | last post by:
Hi all: I'm using a wx.ListView object with a multi-threaded wxPython app. The list is dynamically generated and accessed across two or more threads. In spite of the fact that I have checks to...
0
by: gooli | last post by:
The best thing I've found until now is XRCed. It has it's quirks and pitfalls, but it fits the bill. Personally I prefer the previous version (the one that comes with wxPython 2.8.6) and don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.