473,668 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxPython - get text from wxTextCtrl on a seperate frame

I'm just starting to learn Python & wxPython. I have a frame named
frSend in a file fSend. On this frame is a wxTextCtrl named txtMsg. I
have a module named defs.py

I would like to get the value of txtMsg from within defs.py

I tried the following:

BodyText = fSend.frSend.tx tMsg.GetValue ()

When I run it, I get the following error:

AttributeError: class frSend has no attribute 'txtMsg'

Any help much appreciated.

Russ
Jul 18 '05 #1
3 2545
Russ Phillips wrote:
I'm just starting to learn Python & wxPython. I have a frame named
frSend in a file fSend. On this frame is a wxTextCtrl named txtMsg. I
have a module named defs.py

I would like to get the value of txtMsg from within defs.py

I tried the following:

BodyText = fSend.frSend.tx tMsg.GetValue ()

When I run it, I get the following error:

AttributeError: class frSend has no attribute 'txtMsg'

Any help much appreciated.

Russ

First it might be better to ask this question on wxPython-user group rather
than here - it may help you in the future. Â*
I can't follow the code so I'll provide what I'd normally do.

First I would set my var
#I assume much here
mytextVar=txtMs g.GetValue()
#next create the control
Tcontrol=wx.Tex tCtrl(self,10,m ytextVar, size=(200,300) ....
#make sure you add what style etc to the control
John
Jul 18 '05 #2
Russ Phillips wrote:
I'm just starting to learn Python & wxPython. I have a frame named
frSend in a file fSend. On this frame is a wxTextCtrl named txtMsg. I
have a module named defs.py

I would like to get the value of txtMsg from within defs.py

I tried the following:

BodyText = fSend.frSend.tx tMsg.GetValue ()

When I run it, I get the following error:

AttributeError: class frSend has no attribute 'txtMsg'


As stated in this error message, you are referring to
a wx.Frame *class*, not an instance, and apparently not
what you thought you were doing. Note the difference
in the error messages produced below:
class A: .... pass
.... a = A()

a.test Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: A instance has no attribute 'test' A.test

Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: class A has no attribute 'test'
-Peter
Jul 18 '05 #3
John Fabiani <jf******@yolo. com> wrote in message news:<z1******* ************@ne wssvr14.news.pr odigy.com>...
First it might be better to ask this question on wxPython-user group rather
than here - it may help you in the future.
I can't follow the code so I'll provide what I'd normally do.


Thanks, John.

As it happened, after I posted my question, I had lunch, and when I
came back to it, I got it working! Typical :-)

Thanks again for your help,

Russ
Jul 18 '05 #4

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

Similar topics

0
2411
by: newgene | last post by:
Hi, group, I guess it is a simple question for you, but it puzzles me for a while. I use a wxTextCtrl in my application for output result and any exception msg. I know I can add new msg onto wxTextCtrl by WriteText() method. But I have a function imported from another module and in this function all results are output by "print". I am wondering if I can redirect stdout and stderr into the wxTextCtrl object, so that all output from that...
15
2899
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems to be more low-level than the other GUI toolkits I've used (Tk, GTK, and Trestle), and there are all sorts exposed details in wxWindows/wxPython that I find weird.
0
2161
by: Piet | last post by:
Hello wxPythoneers. I have a problem with a dialog box derived from wxFrame which has a wxComboBox as main element. Depending on the entry selected from the ComboBox, the dialog box will be populated with a number of controls. This works fine for the first selection of a combobox item, but subsequent selections from the combobox cause problems. This is because the event function for the combobox populates the sizer for the window with...
1
2063
by: flupke | last post by:
Hi, i'm trying to convert my java console app to a python gui. Now, the only problem i seem to have at the moment are the resizers for the layout. It seems that for the purpose of what i'm trying to do, specifying the coordinates is easier that fighting with the layout resizers. 1) I have a screen split in 2. Left side is a textcontrol where logging will end up. All text will be appended to the textcontrol. Ideally this should allow...
1
2153
by: mdk.R | last post by:
Hello all: i'am installed wxPython 2.5 and Python2.3.4..i try execute script with wxPython but it show error: Traceback (most recent call last): File "E:\py\test.py", line 7, in ? import wx File "E:\py\wx.py", line 10, in ? from wxPython.wx import * File "D:\Python23\Lib\site-package import _wx
0
1210
by: Scott | last post by:
I have the code below. I have changed the background of the frame to white, but I cannot get the wxSlider to not be the ugly gray color. Can someone tell me how to change it to a transparent background (I tried wxTRANSPARENT_WINDOW without success)? import os from wxPython.wx import * ID_ABOUT=101 ID_EXIT=110 class MainWindow(wxFrame):
2
2271
by: Nicolas Pourcelot | last post by:
Hello, my script worked well until today : when I tried to launch it, I got the following : frame = MyFrame(None,-1,"Geometrie",size=wx.Size(600,400)) File "/home/nico/Desktop/wxGeometrie/version 0.73/geometrie.py", line 74, in __init__ self.commande.Bind(wx.EVT_CHAR, self.EvtChar) AttributeError: wxTextCtrl instance has no attribute 'Bind'
3
3213
by: John Salerno | last post by:
I'm using the sample code of the file 'simple.py' and trying to make a single window with a panel in it, but I keep getting an error. Here's my code: (I know I might need something else, like a Show() method for the panel, but the error stops on the first panel line anyway. I've tried a Layout() method but it didn't get that far). import wx class MyFrame(wx.Frame):
4
3175
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
0
8381
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
8893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8797
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...
0
8656
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
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5681
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();...
1
2791
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
2
1786
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.