473,785 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(p anel, 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 1119
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(p anel, 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(p anel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN_ CENTRE)

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

self.myText.Set Label("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(p anel, 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(p anel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN_ CENTRE)

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

self.myText.Set Label("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(p anel, 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(p anel, 15, "Hello" ,(30, 70) ,
style=wx.ALIGN _CENTRE)

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

self.myText.Se tLabel("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
2544
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 works just fine if i run the code once. but when i call the same piece of code the second time, wxPython.wx.miscc does not exist for some reason. I dont know how this gets deleted. I guess this happens during some kind of clean up. The code that...
3
2822
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
4499
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 happen to already own John Grayson's book about Tkinter programming, so that is rather handy if I decide to use Tkinter. I have done some things slightly more involved than "Hello World" in Tkinter - I have never used wxPython. So, basically the...
14
13373
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 wxGlade I assume) or PyGTK (with Glade I assume)? I'd prefer open source (not necessarily GPL though) tools. Rod
4
6600
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 = wx.Panel(self,-1) self.button = wx.Button(self.panel,-1,"Klikkerdeklik") self.button.SetPosition((200,40)) self.Bind(wx.EVT_BUTTON, self.VeranderLabel, self.button)
2
3178
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 elements and embedds a 3d view of some of the listed objects in an own detail window, so showing the object as a 3d model. I know there is PyOpenGL as well, but I need to load complete models (meshes done with cinema4d or blender) into the 3d view.
1
2385
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 changed all the code so that it was doing an import wx and found that
4
2821
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 assuming that simple_server is class I want to build from for a local web server) -OR- 2. wxPython based GUI
3
2406
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 see if an item at a given index is in the list and the entire set of logic is contained within a try: except: block I periodically get pop-up windows stating "Could not retrieve information for list control item X" when I try to change or access...
0
962
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 really like what's been done with it lately, but that's a matter of taste really. It seems like a really weird thing at first, completely unlike anything in the VB or .NET arena, but after a bit of getting used to it, it becomes quite productive. ...
0
9489
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10100
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.