Attachment 'ListPanel.py'

Download

Toggle line numbers
   1 #coding:utf8
   2 
   3 import wx
   4 import wx.lib.scrolledpanel as scrolled
   5 
   6 class MainPanel(scrolled.ScrolledPanel):
   7 	"""main panel"""
   8 	def __init__(self,*args,**kwds):
   9 		kwds['style']=wx.SUNKEN_BORDER
  10 		scrolled.ScrolledPanel.__init__(self,*args,**kwds)
  11 
  12 		self.ChildLeft=10
  13 		self.ChildTop=20
  14 		self.Child=None
  15        
  16 		self.hbox=wx.BoxSizer(wx.HORIZONTAL)
  17 		self.vbox=wx.BoxSizer(wx.VERTICAL)
  18 
  19 
  20 		self.SetSizer(self.hbox)
  21 		self.SetAutoLayout(1)
  22 		self.SetupScrolling()
  23 
  24 	def SetChild(self,child):
  25 		self.Child=child
  26 		one=child(self,-1)
  27 		one.Hide()
  28 		size=one.GetSize().Get()
  29 		one.Destroy()
  30 		mysize=self.GetSize().Get()
  31 		self.ChildLeft=((mysize[0]-size[0])/2)
  32 		if self.ChildLeft<0:self.ChildLeft=0
  33 		self.hbox.Add((self.ChildLeft,self.ChildTop))
  34 		self.hbox.Add(self.vbox)
  35 
  36 		
  37 	def addChild(self):
  38 		new=self.Child(self,-1)
  39 		self.vbox.Add((-1,self.ChildTop))
  40 		self.vbox.Add(new)
  41 		return new

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-05-11 08:52:43, 0.9 KB) [[attachment:ListPanel.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.