473,769 Members | 5,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SetCellVal ue( 0, 0, 'Testing' )
self.Show( True )
return True

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

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

Jul 18 '05 #1
3 4245
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.pytho n
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.SetCellVal ue( 0 , 0 , 'Testing' )

self.Show( True )

class TestApp( wxApp ) :

def OnInit( self ) :

frame = TestFrame()

self.SetTopWind ow( 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
2844
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 as columnlabels? Johnny
0
1516
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
1259
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 most data is represented as a string. When do data types become an issue in this instance? If I allow the user to edit directly in a cell it seems it doesnt really matter because you can only enforce data validation if i use a form anyways as...
1
7087
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 spreadsheet application in wxpython (my first try with wxpython gui)
4
5380
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 view to view attributes. By this way, the user (i.e. me) will only have the opportunity to change textual contents and attribute values, but neither element nor attribute names. Building the tree view was not a problem, but I haven´t found a good...
1
4948
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
1506
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, but that how I got started ;) -- any help owuld be appreciated
0
1240
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 don't find any methods or properties what can set this option. The range selection mode is disturb the users.
10
4654
by: lux | last post by:
Hi, How can I capture the EVT_SET_FOCUS on a wxGrid? Tank's in advance Luca
0
9587
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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,...
1
9993
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
9863
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
8870
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
7406
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
5298
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...
1
3958
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
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.