Grid.py :  » GUI » wxPython » wxPython-src-2.8.11.0 » wxPython » demo » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » GUI » wxPython 
wxPython » wxPython src 2.8.11.0 » wxPython » demo » Grid.py

import  wx

#---------------------------------------------------------------------------

buttonDefs = {
    814 : ('GridSimple',      ' Simple wx.Grid, catching all events '),
    815 : ('GridStdEdRend',   ' wx.Grid showing Editors and Renderers '),
    818 : ('GridHugeTable',   ' A wx.Grid with a HUGE table (100 MILLION cells!) '),
    817 : ('GridCustTable',   ' wx.Grid using a custom Table, with non-string data '),
    819 : ('GridEnterHandler',' Remapping keys to behave differently '),
    820 : ('GridCustEditor',  ' Shows how to create a custom Cell Editor '),
    821 : ('GridDragable',    ' A wx.Grid with dragable rows and columns '),
    822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'),
    }


class ButtonPanel(wx.Panel):
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        self.log = log

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add((20, 20))
        keys = buttonDefs.keys()
        keys.sort()

        for k in keys:
            text = buttonDefs[k][1]
            btn = wx.Button(self, k, text)
            box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 10)
            self.Bind(wx.EVT_BUTTON, self.OnButton, btn)

        self.SetSizer(box)
        box.Fit(self)
        

    def OnButton(self, evt):
        modName = buttonDefs[evt.GetId()][0]
        module = __import__(modName)
        frame = module.TestFrame(None, self.log)
        frame.Show(True)


#---------------------------------------------------------------------------

def runTest(frame, nb, log):
    win = ButtonPanel(nb, log)
    return win

#---------------------------------------------------------------------------



overview = """\
<html><body>
<h2>wx.grid.Grid</h2>

This demo shows various ways of using the wx.grid.Grid class. 
<p>
You can look at the sources for these samples to learn a lot about how
the new classes work.
<p><ol>
<li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
how to catch all the various events.

<p>
<li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
uses non-default Cell Editors and Cell Renderers.

<p>
<li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
uses a non-default Grid Table.  This table is read-only and simply
generates on the fly a unique string for each cell.

<p>
<li><a href="GridCustTable.py">GridCustTable.py</a> This grid
shows how to deal with tables that have non-string data, and how Cell
Editors and Cell Renderers are automatically chosen based on the data
type.

<p>
<li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
changes how the ENTER key works, moving the current cell left to right
and wrapping around to the next row when needed.
</ol>
<p>

"""


if __name__ == '__main__':
    import sys,os
    import run
    run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.