ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
RE: [wxpython-users] Simple scope question
by Kyle W Rickey other posts by this author
Jul 8 2008 11:57AM messages near this date
Re: [wxpython-users] Simple scope question | [wxpython-users] ScrolledPanel scrolls without touching the ScrollBar
Short answer, define your grid like this:

def __init__(self):
	self.grid = wx.grid.Grid(etc...)

and then later:

def SomeFunction(self):
	self.grid.SetCellValue(r, c, value)


self is like saying make this an attribute of this class. I'm not good
at describing it but have a look at the long answer:

http://python.org/doc/current/tut/node11.html#SECTION0011320000000000000
000

Kyle Rickey

-----Original Message-----
From: wxpython-users-bounces@[...].org
[mailto:wxpython-users-bounces@[...].org] On Behalf Of John
Dann
Sent: Tuesday, July 08, 2008 1:47 PM
To: wxPython-users@[...].org
Subject: [wxpython-users] Simple scope question

Fairly new to Python and wxP so there's probably something simple
that I haven't grasped yet about assigning the scope of objects:

Problem is as follows:

I've declared a grid object in my Frame's __init__:

def __init__(self)
     ....
     grid = wx.grid.Grid(etc...)

I then want to assign some values to various grid cells from within a
different function but within the same frame class, ie

def otherfunction(self)
     grid.SetCellValue(r, c, value)

but I keep getting errors about the grid object being unrecognised
whether I do

     grid.SetCellValue

or

     self.grid.SetCellValue

Is there something obvious that I'm missing?



_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
John Dann
Raffaello
Phil Mayes
Robin Dunn
Raffaello
Robin Dunn
Timothy Grant
Josiah Carlson
Christopher Barker
Raffaello
Kyle W Rickey

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved