Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 2nd, 2003, 05:51 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
Arrow Strange error.

I have made a simple app in wxPython with Boa, when the user pressess a button, a text is copied from an TextCtrl to a Label.

The following code stands in the button event:

Code:
Label.label = Text.value


Label is the Label
Text is the TextCtrl

They both exist, but it says that they do not exist.

Reply With Quote
  #2  
Old August 2nd, 2003, 06:21 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Yo yo old bean,

Your gonna have to give us a little more info. Can you post the actual error message or attach the code so those with wxPython and or Boa can see whats going on for themselves. It's just a tad hard to see whats happening from two lines of code #

Tata,
Mark.

Reply With Quote
  #3  
Old August 2nd, 2003, 06:36 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
Here is it.
Attached Files
File Type: zip app-with-error.zip (2.8 KB, 224 views)

Reply With Quote
  #4  
Old August 2nd, 2003, 06:58 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Ok, my mistake, you appear to need the Boa to run this, I thought it was just a program? ah well sorry cant really help to much, you could post the error message though.

Mark.

Reply With Quote
  #5  
Old August 2nd, 2003, 07:18 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
errors:

Code:
Traceback (most recent call last):
  File "C:\aery5\wxFrame1.py", line 41, in OnButton1Button
    Label.label = Text.value
NameError: global name 'Text' is not defined

Reply With Quote
  #6  
Old August 2nd, 2003, 07:28 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Problem solved, The error was being caused because "gloabl Text does not exist" and it doesn't, you do have self.Text though. I changed the line..

Label.label = Text.value

to..

Label.label = self.Text.value

and it works fine. Hope this helps!

EDIT: closer examination and it isnt accessing the value. But the window shows up. Apparently wxTextCtrl has no attrabute value

Have fun,
Mark.

Last edited by netytan : August 2nd, 2003 at 07:30 AM.

Reply With Quote
  #7  
Old August 2nd, 2003, 10:33 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
it does has a attribute value. i can see it on the constructor tab.

Reply With Quote
  #8  
Old August 2nd, 2003, 12:38 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 18 m 50 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
We'll thats just the error i was getting, i have very little exp with GUI programming. The fact was, Python was complaining that it has no value attrabute which means it couldn't find one! Sorry dude I don't know. If I'm getting this right all your trying to do is get input from the entry box and display it, obviously there is an error in the way your trying to do this..

Mark.

Reply With Quote
  #9  
Old August 3rd, 2003, 05:55 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
Can anyone else help me?

Reply With Quote
  #10  
Old August 3rd, 2003, 08:30 AM
percivall percivall is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 133 percivall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Not knowing wxPython, not having looked at the documentation, I can offer you little qualified help in ultimately solving your problem. On the other hand, I know what you are doing wrong.

It is true that there is no 'Text' attribute in the global namespace. On the other hand, there is a 'Text' attribute in the instance namespace. The same goes for the 'Label' attribute, btw. You have to access all instance data objects by explicitly prefixing 'self.'

Code:
def OnButton1Button(self, event):
        self.Label = wxStaticText(id=wxID_WXFRAME1LABEL,
       	        label=self.Text.GetValue(), name='Label', parent=self,
       	        pos=wxPoint(8, 40), size=wxSize(95, 13), style=0)
       	self.Validate()


The above piece of code will paint what you write on top of the previous text. As I said, not much help, but perhaps it'll get you moving.

Reply With Quote
  #11  
Old August 3rd, 2003, 10:28 AM
Mr_??? Mr_??? is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 11 Mr_??? User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 35 m 51 sec
Reputation Power: 0
Solved! Thanks for code.

This is the solution that i used:

Code:
self.Label.SetLabel(self.Text.GetValue())


And it worked correctly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Strange error.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |