473,287 Members | 1,581 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,287 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 1089
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.