473,322 Members | 1,232 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,322 software developers and data experts.

wxGrid?

#
# Python 2.2.3, wxWindows/wxPython 2.4.1
#
# The code:
#

from wxPython.wx import *

class TestFrame( wxFrame ):
def __init__( self ):
wxFrame.__init__( self, None, -1, 'TestGrid' )

# the problem line >>> NameError: global name 'wxGrid' is not defined

grid = wxGrid( self, -1 )
grid.AppendCols( 2 )
grid.AppendRows( 3 )
grid.SetCellValue( 0, 0, 'Testing' )
self.Show( True )
return True

class TestApp( wxApp ):
def OnInit( self ):
frame = TestFrame()
self.SetTopWindow( frame )

return True
if __name__ == '__main__':
app = TestApp( 0 )
app.MainLoop()
#
# Any ideas?
#

Jul 18 '05 #1
3 4218
Tom ...

I was able to run your script
by adding two lines ...

from wxPython.grid import *

and

grid.CreateGrid( 3 , 2 )

Cousin Stanley

-----------------------------------------------------------

'''
NewsGroup .... comp.lang.python
Date ......... 2003-09-03
Posted_By .... Tom Lee
Edited_By .... Stanley C. Kitching
'''

from wxPython.wx import *
from wxPython.grid import *

class TestFrame( wxFrame ) :

def __init__( self ) :

wxFrame.__init__( self , None, -1 , 'TestGrid' ,
size = ( 430 , 185 ) )

grid = wxGrid( self, -1 )

grid.CreateGrid( 3 , 2 )

grid.AppendCols( 2 )
grid.AppendRows( 3 )

grid.SetCellValue( 0 , 0 , 'Testing' )

self.Show( True )

class TestApp( wxApp ) :

def OnInit( self ) :

frame = TestFrame()

self.SetTopWindow( frame )

return True

if __name__ == '__main__' :

app = TestApp( 0 )

app.MainLoop()
Jul 18 '05 #2
I was able to run your script
by adding two lines ...

AND ... deleting ... return True
from the __init__ method

--
Cousin Stanley
Human Being
Phoenix, Arizona
Jul 18 '05 #3
Cousin Stanley wrote:
I was able to run your script
by adding two lines ...

AND ... deleting ... return True
from the __init__ method


Oops how'd that get in there. :S that was meant for OnInit

Cheers, your solution works perfectly. Is there any place I can look up
controls like this that are grouped externally to the rest of the
wxpython classes?

wxWindows provides excellent docs, but I can't seem to find much in the
way of python module/package names for certain controls (such as
wxPython.stc)

Regardless, thanks again.

Tom L

Jul 18 '05 #4

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

Similar topics

6
by: Johnny Geling | last post by:
I would like use custom labelnames for rows in the wxGrid which I use through wxpython. The SetRowLabelValue from wxGridTableBase isn't doing anything. Is it posible to use custom rowlabels same...
0
by: Kepes Krisztian | last post by:
Hi ! My problem is that: 1.) I want to create a frame with some buttons, and client area. If the user clicked on a button, the procedure create components on client area, and show results.
0
by: marvin | last post by:
hi- i worked on a project in TCL/TK found at j_m_mc.tripod.com. I want to allow the user to edit the table using wxGrid and python. I'm just looking for some tips. For i.e. in sqlite and TCL...
1
by: matthiasjanes | last post by:
dear all, I just need a little help. could anyone give real code example (simple) how to read the value of a grid cell. i could not figure it out and really would like to do a simple...
4
by: Piet | last post by:
Hello. I am working on an XML editor that will not display the xml file as plain text, but will rather work with a combination of a tree view for the main element nodes and some kind of tabular...
1
by: James | last post by:
wxpython 2.5.3 hi, anyone know how to make a multiline cell editor for wxgrid? thank you :) best regards, James
1
by: Sam the Cat | last post by:
using "from wxPython.wx import *" under python2.3 I cannot seem to find the wxGrid class -- it says its undefined -- am I missing something obvious ? I know the globalspace import is not the best,...
0
by: fowlertrainer | last post by:
Hi ! I have a little problem with wxGrid. In Delphi I can set in grids how I want to select cells. I can select only individual cells, or ranges. In my program I don't wanna use ranges. But I...
10
by: lux | last post by:
Hi, How can I capture the EVT_SET_FOCUS on a wxGrid? Tank's in advance Luca
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: 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: 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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.