Hi !
I’m angry. I don’t understand the in this frame why I don’t get
“packed” (layout) result in the upper panel.
This is a Boa generated file. It is working (I think) in every machine.
I want to pack the upper panel height to the minimal value what is
possible.
See my draw.
I want to do this:
···
Search text|ComboBox1__________________|Button1|
But that is not packed:
Search text|ComboBox1__________________|Button1|
> > >
So the height of the panel, and it’s components is not fitted. Why ?
How to I fit it ?
Plase help me ! Thanx for it:
ft
#Boa:Frame:Frame1
import wx
import wx.grid
def create(parent):
return Frame1(parent)
[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1COMBOBOX1,
wxID_FRAME1LISTCTRL1,
wxID_FRAME1PANEL1, wxID_FRAME1PANEL2, wxID_FRAME1STATICTEXT1,
] = [wx.NewId() for _init_ctrls in range(7)]
class Frame1(wx.Frame):
def _init_coll_boxSizer3_Items(self, parent):
# generated method, don't edit
parent.AddWindow(self.listCtrl1, 1, border=2, flag=wx.EXPAND |
wx.ALL)
def _init_coll_boxSizer2_Items(self, parent):
# generated method, don't edit
parent.AddWindow(self.staticText1, 0, border=2, flag=wx.EXPAND
wx.ALL)
parent.AddWindow(self.comboBox1, 0, border=2, flag=wx.EXPAND |
wx.ALL)
parent.AddWindow(self.button1, 0, border=2, flag=wx.EXPAND |
wx.ALL)
def _init_coll_boxSizer1_Items(self, parent):
# generated method, don't edit
parent.AddWindow(self.panel1, 0, border=2, flag=wx.EXPAND |
wx.ALL)
parent.AddWindow(self.panel2, 1, border=2, flag=wx.EXPAND |
wx.ALL)
def _init_coll_imageList1_Images(self, parent):
# generated method, don't edit
parent.Add(bitmap=wx.Bitmap(u'C:/Private/dev/PyCDCat/cd.png',
wx.BITMAP_TYPE_PNG), mask=wx.NullBitmap)
parent.Add(bitmap=wx.Bitmap(u'C:/Private/dev/PyCDCat/dir.png',
wx.BITMAP_TYPE_PNG), mask=wx.NullBitmap)
parent.Add(bitmap=wx.Bitmap(u'C:/Private/dev/PyCDCat/file.png',
wx.BITMAP_TYPE_PNG), mask=wx.NullBitmap)
def _init_coll_listCtrl1_Columns(self, parent):
# generated method, don't edit
parent.InsertColumn(col=0, format=wx.LIST_FORMAT_LEFT,
heading=u’CD ID’,
width=80)
parent.InsertColumn(col=1, format=wx.LIST_FORMAT_LEFT,
heading=u'Filename', width=192)
parent.InsertColumn(col=2, format=wx.LIST_FORMAT_LEFT,
heading=u'File time', width=128)
parent.InsertColumn(col=3, format=wx.LIST_FORMAT_LEFT,
heading=u'CD desc', width=128)
parent.InsertColumn(col=4, format=wx.LIST_FORMAT_LEFT,
heading=u’Attr’,
width=80)
parent.InsertColumn(col=5, format=wx.LIST_FORMAT_LEFT,
heading=u’Size’,
width=-1)
parent.InsertColumn(col=6, format=wx.LIST_FORMAT_LEFT,
heading=u'File desc', width=128)
def _init_utils(self):
# generated method, don't edit
self.imageList1 = wx.ImageList(height=16, width=16)
self._init_coll_imageList1_Images(self.imageList1)
def _init_sizers(self):
# generated method, don't edit
self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
self.boxSizer2 = wx.BoxSizer(orient=wx.HORIZONTAL)
self.boxSizer3 = wx.BoxSizer(orient=wx.VERTICAL)
self._init_coll_boxSizer1_Items(self.boxSizer1)
self._init_coll_boxSizer2_Items(self.boxSizer2)
self._init_coll_boxSizer3_Items(self.boxSizer3)
self.SetSizer(self.boxSizer1)
self.panel1.SetSizer(self.boxSizer2)
self.panel2.SetSizer(self.boxSizer3)
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
pos=wx.Point(400, 178), size=wx.Size(502, 472),
style=wx.DEFAULT_FRAME_STYLE, title=u'Search in Database')
self._init_utils()
self.SetClientSize(wx.Size(494, 438))
self.Center(wx.BOTH)
self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1',
parent=self,
pos=wx.Point(2, 2), size=wx.Size(490, 35),
style=wx.TAB_TRAVERSAL)
self.panel1.SetBackgroundColour(wx.Colour(168, 149, 38))
self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2, name='panel2',
parent=self,
pos=wx.Point(2, 41), size=wx.Size(490, 395),
style=wx.TAB_TRAVERSAL)
self.panel2.SetBackgroundColour(wx.Colour(107, 188, 18))
self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
label=u'Search text', name='staticText1',
parent=self.panel1,
pos=wx.Point(2, 2), size=wx.Size(54, 31), style=0)
self.comboBox1 = wx.ComboBox(choices=[],
id=wxID_FRAME1COMBOBOX1,
name='comboBox1', parent=self.panel1, pos=wx.Point(60, 2),
size=wx.Size(349, 21), style=0, value='comboBox1')
self.comboBox1.Bind(wx.EVT_CHAR, self.OnComboBox1Char)
self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label=u'Search
!',
name='button1', parent=self.panel1, pos=wx.Point(413, 2),
size=wx.Size(75, 31), style=0)
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
id=wxID_FRAME1BUTTON1)
self.listCtrl1 = wx.ListCtrl(id=wxID_FRAME1LISTCTRL1,
name=‘listCtrl1’,
parent=self.panel2, pos=wx.Point(2, 2), size=wx.Size(486,
391),
style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
self.listCtrl1.SetImageList(self.imageList1,
wx.IMAGE_LIST_SMALL)
self._init_coll_listCtrl1_Columns(self.listCtrl1)
self._init_sizers()
def __init__(self, parent):
self._init_ctrls(parent)
self.Fit()
self.comboBox1.SetValue('')
self.comboBox1.SetFocus()
def SearchIt(self):
stofind=s=self.comboBox1.GetValue()
s=s.upper()
print s
import mediadb
ws=WhatSearch={}
ws['text']=s
sr=mediadb.SearchForFiles(WhatSearch)
print len(sr)
cdl=self.listCtrl1
cdl.DeleteAllItems()
for r in sr:
ic=cdl.GetItemCount()
cdl.InsertStringItem(ic,'')
cdl.SetItemImage(0,1,1)
print "add"
print r
'''
rootdir_id integer not null,
'''
imgidx=1
if r['f.dirtype']==0:
imgidx=2
cdl.SetItemImage(ic,imgidx,imgidx)
cdl.SetStringItem(ic,0,str(r['m.mediaid']))
cdl.SetStringItem(ic,1,str(r['f.name']))
cdl.SetStringItem(ic,2,str(r['f.time']))
cdl.SetStringItem(ic,3,str(r['mediadesc']))
#print r['f.time']
cdl.SetStringItem(ic,4,str(r['f.attr']))
cdl.SetStringItem(ic,5,str(r['f.size']))
cdl.SetStringItem(ic,6,str(r['f.desc']))
p=self.comboBox1.FindString(stofind)
if p==wx.NOT_FOUND:
self.comboBox1.Append(stofind)
def OnButton1Button(self, event):
self.SearchIt()
event.Skip()
def OnComboBox1KeyUp(self, event):
event.Skip()
def OnComboBox1KeyDown(self, event):
event.Skip()
def OnComboBox1Char(self, event):
s=event.GetKeyCode()
if s==13:
self.SearchIt()
event.Skip()
if name == ‘main’:
app = wx.PySimpleApp()
wx.InitAllImageHandlers()
frame = create(None)
frame.Show()
app.MainLoop()