小默

【转】请教个思路关于用wx.Grid操作数据库

用Grid读取操作数据库添加,修改数据一般都用什么方法?
要求可以再Grid上修改数据,修改后可以保存到数据库

有没有个操作数据库的实际例子

谢谢

==============

使用wx.grid.PyGridTableBase, 然后自己定义SetValue, 在里面实现你的数据库操作, 就可以在修改grid的时候, 同时更新数据库.
添加和删除行需要自己定义事件, 事件的触发可以是button或者是contextmenu.

例子在wxPython2.8 Docs and Demos\demo目录下有(以Grid开头的文件).

=============

Package wx :: Module grid :: Class PyGridTableBase
[frames | no frames]

Type PyGridTableBase

object --+
|
Object --+
|
GridTableBase --+
|
PyGridTableBase


Proxy of C++ PyGridTableBase class


Method Summary
PyGridTableBase __init__(self)
  base_AppendCols(*args, **kwargs) 
Please use PyGridTableBase.AppendCols instead.
  base_AppendRows(*args, **kwargs) 
Please use PyGridTableBase.AppendRows instead.
  base_CanGetValueAs(*args, **kwargs) 
Please use PyGridTableBase.CanGetValueAs instead.
  base_CanHaveAttributes(*args, **kwargs) 
Please use PyGridTableBase.CanHaveAttributes instead.
  base_CanSetValueAs(*args, **kwargs) 
Please use PyGridTableBase.CanSetValueAs instead.
  base_Clear(*args, **kwargs) 
Please use PyGridTableBase.Clear instead.
  base_DeleteCols(*args, **kwargs) 
Please use PyGridTableBase.DeleteCols instead.
  base_DeleteRows(*args, **kwargs) 
Please use PyGridTableBase.DeleteRows instead.
  base_GetAttr(*args, **kwargs) 
Please use PyGridTableBase.GetAttr instead.
  base_GetColLabelValue(*args, **kwargs) 
Please use PyGridTableBase.GetColLabelValue instead.
  base_GetRowLabelValue(*args, **kwargs) 
Please use PyGridTableBase.GetRowLabelValue instead.
  base_GetTypeName(*args, **kwargs) 
Please use PyGridTableBase.GetTypeName instead.
  base_InsertCols(*args, **kwargs) 
Please use PyGridTableBase.InsertCols instead.
  base_InsertRows(*args, **kwargs) 
Please use PyGridTableBase.InsertRows instead.
  base_SetAttr(*args, **kwargs) 
Please use PyGridTableBase.SetAttr instead.
  base_SetColAttr(*args, **kwargs) 
Please use PyGridTableBase.SetColAttr instead.
  base_SetColLabelValue(*args, **kwargs) 
Please use PyGridTableBase.SetColLabelValue instead.
  base_SetRowAttr(*args, **kwargs) 
Please use PyGridTableBase.SetRowAttr instead.
  base_SetRowLabelValue(*args, **kwargs) 
Please use PyGridTableBase.SetRowLabelValue instead.
  Destroy(self) 
Deletes the C++ object this Python object is a proxy for.

Property Summary
  thisown: The membership flag

Method Details

base_AppendCols(*args, **kwargs)

Please use PyGridTableBase.AppendCols instead.

base_AppendRows(*args, **kwargs)

Please use PyGridTableBase.AppendRows instead.

base_CanGetValueAs(*args, **kwargs)

Please use PyGridTableBase.CanGetValueAs instead.

base_CanHaveAttributes(*args, **kwargs)

Please use PyGridTableBase.CanHaveAttributes instead.

base_CanSetValueAs(*args, **kwargs)

Please use PyGridTableBase.CanSetValueAs instead.

base_Clear(*args, **kwargs)

Please use PyGridTableBase.Clear instead.

base_DeleteCols(*args, **kwargs)

Please use PyGridTableBase.DeleteCols instead.

base_DeleteRows(*args, **kwargs)

Please use PyGridTableBase.DeleteRows instead.

base_GetAttr(*args, **kwargs)

Please use PyGridTableBase.GetAttr instead.

base_GetColLabelValue(*args, **kwargs)

Please use PyGridTableBase.GetColLabelValue instead.

base_GetRowLabelValue(*args, **kwargs)

Please use PyGridTableBase.GetRowLabelValue instead.

base_GetTypeName(*args, **kwargs)

Please use PyGridTableBase.GetTypeName instead.

base_InsertCols(*args, **kwargs)

Please use PyGridTableBase.InsertCols instead.

base_InsertRows(*args, **kwargs)

Please use PyGridTableBase.InsertRows instead.

base_SetAttr(*args, **kwargs)

Please use PyGridTableBase.SetAttr instead.

base_SetColAttr(*args, **kwargs)

Please use PyGridTableBase.SetColAttr instead.

base_SetColLabelValue(*args, **kwargs)

Please use PyGridTableBase.SetColLabelValue instead.

base_SetRowAttr(*args, **kwargs)

Please use PyGridTableBase.SetRowAttr instead.

base_SetRowLabelValue(*args, **kwargs)

Please use PyGridTableBase.SetRowLabelValue instead.

Destroy(self)

Deletes the C++ object this Python object is a proxy for.

Overrides:
wx.Object.Destroy

Property Details

thisown

The membership flag

Get Method:
unknown-32025128(...)
Set Method:
unknown-32025248(...)

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:52:14 2009 http://epydoc.sf.net

posted on 2010-08-23 13:16 小默 阅读(1226) 评论(0)  编辑 收藏 引用 所属分类: Language


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


导航

统计

留言簿(13)

随笔分类(287)

随笔档案(289)

漏洞

搜索

积分与排名

最新评论

阅读排行榜