- 论坛徽章:
- 0
|
from wxPython.wx import *
from wxPython.grid import *
SchemeNum=map(lambda x:str(x+1),range(25))
equipItem=['a','b','c','d']
usersel25={25:{1:{},
2:{1:["数控车床-2","CK6132/750","荆州荷花机床有限公司"] ,
2: ["斜床身数控车床","KDCK-20A","浙江吵大机床集团有限公司"] ,
3: ["平床身数控车床","CAK6140VA/1000","沈阳数控机床有限责任公司"],
4: ["数控床身铣床-1","YHM600(A)","深圳市华亚数控机床有限公司"],
5: ["数控床身铣床-2","XK714","武汉华中数控股份有限公司"],
6: ["数控床身铣床-3","XK715","江苏多棱数控机床股份有限公司"],
7: ["数控钻铣床","ZJK7532A-4","武汉第四机床厂"],
8: ["立式加工中心-2","VMC750E","北京机电院高技术股份有限公司"],
9: ["车削加工中心","CHD6126","大连机床集团有限责任公司"],
10: ["电火花成型机床","CTE300ZK","北京迪蒙卡特机械电子设备技术有限责任公司"],
11: ["快走丝线切割机床-1","CTW320TA","北京迪蒙卡特机械电子设备技术有限责任公司"],
12: ["数控模拟仿真软件","VNUC V1.6","北京市斐克科技有限责任公司"],
13: ["CAD/CAM应用软件","CAXA制造工程师软件XP","北京北航海尔软件有限公司"]
},
3:{}
}
}
class myapp(wxApp):
def OnLeftDClick(self,event):
#pt = event.GetPosition()
#item, flags = tree.HitTest(pt)
grid.SetCellValue(0,0,"dddd"
def OnItemExpanded(self,event):
pass
def OnInit(self):
self.frame=wxFrame(None, -1, "窗口", (10,10),(1000,700))
self.frame.Show(true)
self.SetTopWindow(self.frame)
t1=wxStaticText(self.frame, -1, "招标单位:",pos=(10,15),size = wxDefaultSize)
tc1=wxTextCtrl(self.frame, -1, "",pos=(70,11),size = (200,20))
t2=wxStaticText(self.frame, -1, "文件编号:",pos=(300,15),size = wxDefaultSize)
tc2=wxTextCtrl(self.frame, -1, "0702-CITC04N6680601",pos=(360,11),size = (150,20))
t3=wxStaticText(self.frame, -1, "包号:",pos=(520,15),size = wxDefaultSize)
ch=wxChoice(self.frame, -1, (560,12),(100,100), SchemeNum)
t4=wxStaticText(self.frame, -1, "方案号:",pos=(680,15),size = wxDefaultSize)
ch=wxChoice(self.frame, -1, (730,12),(100,100), SchemeNum)
####################################################################
isz = (8,
il = wxImageList(isz[0], isz[1])
fldridx = il.Add(wxArtProvider_GetBitmap(wxART_FOLDER, wxART_OTHER, isz))
fldropenidx = il.Add(wxArtProvider_GetBitmap(wxART_FILE_OPEN, wxART_OTHER, isz))
fileidx = il.Add(wxArtProvider_GetBitmap(wxART_REPORT_VIEW, wxART_OTHER, isz))
t5=wxStaticText(self.frame, -1, "设备树:",pos=(20,50),size = wxDefaultSize)
tree=wxTreeCtrl(self.frame, -1, (20,60),(600,250),wxTR_HAS_BUTTONS|wxTR_EDIT_LABELS)
root = tree.AddRoot("Root"
tree.SetItemImage(root, fldridx, wxTreeItemIcon_Normal)
tree.SetItemImage(root, fldropenidx, wxTreeItemIcon_Expanded)
for item in usersel25[25][2]:
child=tree.AppendItem(root,usersel25[25][2][item][0])
child_2=tree.AppendItem(child,usersel25[25][2][item][1]+"||"+usersel25[25][2][item][2])
tree.Expand(root)
############################################################################
EVT_LEFT_DCLICK(tree,self.OnLeftDClick)
#这里出错,高手帮忙!我希望双击叶子后,grid里可以显示双击的内容
grid=wxGrid(self.frame,-1,(20,350),(800,250))
grid.CreateGrid(13, 4)
grid.SetRowLabelSize(60)
grid.SetColLabelSize(20)
grid.SetColSize(0, 200)
grid.SetColSize(1, 160)
grid.SetColSize(2, 200)
grid.SetColLabelValue(0,'项目')
grid.SetColLabelValue(1,'型号')
grid.SetColLabelValue(2,'厂商')
grid.SetColLabelValue(3,'方案')
return True
app=myapp(0)
app.MainLoop() |
|