def __init__(self, parent):
"""Constructor"""
self.notUseDetaul = None
wx.Panel.__init__(self, parent=parent, size = (500,800))
B = wx.StaticBox(self, -1)
BSizer = wx.StaticBoxSizer(B, wx.VERTICAL)
self.imagesDir = os.path.join(".", "images")
self.screenShotDir = os.path.join(".", "screenShot")
self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage)
self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll)
self.statusBar = wx.StaticText(self, -1, "")
BSizer.Add(self.statusBar)
BSizer.Add(self.screenShot,5,wx.EXPAND, 5)
self.SetSizer(BSizer)
pub.subscribe(self.updateStatus, "update")
pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode")
pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput")
self.hasDrew = False
python类VERTICAL的实例源码
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent=parent)
B = wx.StaticBox(self, -1)
self.BSizer = wx.StaticBoxSizer(B, wx.VERTICAL)
self.tree = XMLTree(parent=self, ID=-1)
self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.onSelectItem)
self.tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.getFullXpath)
self.BSizer.Add(self.tree, 5, wx.EXPAND, 5)
self.SetSizer(self.BSizer)
cDir = os.getcwd()
self.xmlPath = os.path.join(cDir,"Hierarchy","window_dump.xml")
pub.subscribe(self.updateTree, "updateTree")
pub.subscribe(self.setSelectedNode, "setSelectedNode")
pub.subscribe(self.DoSearch, "DoSearch")
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
# ?????
self.response_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
response_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response"))
response_sizer.Add(self.response_text, 1, wx.EXPAND)
# ???????
self.doc_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY)
doc_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Document"))
doc_sizer.Add(self.doc_text, 1, wx.EXPAND)
main_box = wx.BoxSizer(wx.VERTICAL)
main_box.Add(response_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(doc_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
self.SetSizer(main_box)
self.response_text.Bind(wx.EVT_CHAR, self.on_key_down)
self.doc_text.Bind(wx.EVT_CHAR, self.on_key_down)
def populate_tiles(self):
if not self._tileset:
self._tilemap.clear()
surface = self._presenter.surface
tiles_width = int(math.floor(surface.width / float(Tilemap.TILE_SIZE)))
tiles_height = int(math.ceil(len(self._tileset.tiles) / float(tiles_width)))
tiles = range(0, len(self._tileset.tiles))
self._tilemap = Tilemap(tiles, tiles_width, tiles_height)
self._camera.set_max(tiles_width * Tilemap.TILE_SIZE, tiles_height * Tilemap.TILE_SIZE)
self.Scrollbar.SetScrollbar(wx.VERTICAL, 0, surface.height, tiles_height, True)
self.Scrollbar.SetThumbPosition(0)
def __init__( self, parent, title):
wx.Dialog.__init__ (self, parent, -1, title, style = wx.DEFAULT_DIALOG_STYLE)
self.lst = wx.BoxSizer( wx.VERTICAL )
self.tus = []
self.funcs = {'ctrl':self.add_ctrl, 'slide':self.add_slide, int:self.add_num,
float:self.add_num, 'lab':self.add_lab, bool:self.add_check,
str:self.add_txt, list:self.add_choice, 'img':self.add_img,
'tab':self.add_tab, 'color':self.add_color}
self.on_ok, self.on_cancel = None, None
self.ctrl_dic = {}
boxBack = wx.BoxSizer()
boxBack.Add(self.lst, 0, wx.ALL, 10)
self.SetSizer( boxBack )
self.Layout()
self.handle = self.handle_
def gray(self, hist):
panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
back = wx.BoxSizer( wx.VERTICAL )
back.Add(panel, 1, wx.EXPAND)
sizer = wx.BoxSizer( wx.VERTICAL )
histc = HistCanvas(panel)
histc.set_hist(hist)
txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+'Gray', wx.DefaultPosition, wx.DefaultSize, 0 )
sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 )
sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 )
mean, lim = np.dot(hist, range(256))/hist.sum(), np.where(hist>0)[0]
sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max())
txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 )
sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 )
panel.SetSizer( sizer )
self.SetSizer(back)
self.Fit()
def __do_layout(self):
# begin wxGlade: add_academic_year.__do_layout
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(2, 1, 10, 10)
sizer_4 = wx.BoxSizer(wx.VERTICAL)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3.Add(self.label_3, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
sizer_3.Add(self.text_ctrl_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_3.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_3.Add(self.text_ctrl_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
sizer_5.Add(self.button_close, 0, wx.RIGHT, 20)
sizer_5.Add(self.button_add, 0, wx.LEFT, 20)
sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_VERTICAL, 10)
grid_sizer_1.Add(sizer_4, 1, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 30)
sizer_2.Add(grid_sizer_1, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
sizer_1.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def __init__( self, parent, id, titlemsg ):
wx.Dialog.__init__( self, parent, id, title=titlemsg )
MechList = []
for m in parent.ScoreServer.MechList.List:
MechList.append( str(m.ID) + ": " + str(m.Name) )
self.MechText = wx.StaticText( self, -1, "Mech Selection:" )
self.MechChoice = wx.ListBox( self, -1, style=wx.LB_EXTENDED, choices=MechList )
self.CancelButton = wx.Button( self, wx.ID_CANCEL, "Cancel" )
self.OKButton = wx.Button( self, wx.ID_OK, "OK" )
TopSizer = wx.BoxSizer( wx.VERTICAL )
BtnSizer = wx.BoxSizer( wx.HORIZONTAL )
BtnSizer.Add( self.CancelButton, 0, wx.ALL, 5 )
BtnSizer.Add( self.OKButton, 0, wx.ALL, 5 )
TopSizer.Add( self.MechText, 0, wx.ALL, 5 )
TopSizer.Add( self.MechChoice, 0, wx.ALL, 5 )
TopSizer.Add( BtnSizer, 0, wx.ALL|wx.CENTER, 5 )
self.SetSizer( TopSizer )
TopSizer.Fit( self )
def __do_layout(self):
# begin wxGlade: TerminalSettingsDialog.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
self.sizer_4_staticbox.Lower()
sizer_4 = wx.StaticBoxSizer(self.sizer_4_staticbox, wx.VERTICAL)
sizer_4.Add(self.checkbox_echo, 0, wx.ALL, 4)
sizer_4.Add(self.checkbox_unprintable, 0, wx.ALL, 4)
sizer_4.Add(self.radio_box_newline, 0, 0, 0)
sizer_2.Add(sizer_4, 0, wx.EXPAND, 0)
sizer_3.Add(self.button_ok, 0, 0, 0)
sizer_3.Add(self.button_cancel, 0, 0, 0)
sizer_2.Add(sizer_3, 0, wx.ALL | wx.ALIGN_RIGHT, 4)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
def __do_layout(self):
# begin wxGlade: TerminalSettingsDialog.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_4 = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Input/Output"), wx.VERTICAL)
sizer_4.Add(self.checkbox_echo, 0, wx.ALL, 4)
sizer_4.Add(self.checkbox_unprintable, 0, wx.ALL, 4)
sizer_4.Add(self.radio_box_newline, 0, 0, 0)
sizer_2.Add(sizer_4, 0, wx.EXPAND, 0)
sizer_3.Add(self.button_ok, 0, 0, 0)
sizer_3.Add(self.button_cancel, 0, 0, 0)
sizer_2.Add(sizer_3, 0, wx.ALL|wx.ALIGN_RIGHT, 4)
self.SetAutoLayout(1)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
sizer_2.SetSizeHints(self)
self.Layout()
# end wxGlade
def __init__(self, parent, frame, ID, label):
wx.Panel.__init__(self, parent, ID)
self.frame = frame
box = wx.StaticBox(self, -1, label)
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
self.next_button = wx.Button(self, -1, label="Next 100")
self.next_button.Bind(wx.EVT_BUTTON, self.on_next)
self.previous_button = wx.Button(self, -1, label="Previous 100")
self.previous_button.Bind(wx.EVT_BUTTON, self.on_previous)
manual_box = wx.BoxSizer(wx.HORIZONTAL)
manual_box.Add(self.previous_button, flag=wx.ALIGN_CENTER_VERTICAL)
manual_box.AddSpacer(10)
manual_box.Add(self.next_button, flag=wx.ALIGN_CENTER_VERTICAL)
sizer.Add(manual_box, 0, wx.ALL, 10)
self.SetSizer(sizer)
sizer.Fit(self)
def __init__(self, parent):
wx.Dialog.__init__(self, parent, -1, title=u"Logon", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
vsizer = wx.BoxSizer(orient=wx.VERTICAL)
gb = wx.GridBagSizer()
gb.Add(wx.StaticText(self, -1, u"Username"), flag=wx.ALL|wx.EXPAND, border=10, pos=(0,0))
self._name = wx.TextCtrl(self, -1)
gb.Add(self._name, flag=wx.ALL|wx.EXPAND, border=10, pos=(0,1))
gb.Add(wx.StaticText(self, -1, u"Password"), flag=wx.ALL|wx.EXPAND, pos=(1,0), border=10)
self._pass = wx.TextCtrl(self, -1, style=wx.TE_PASSWORD)
gb.Add(self._pass, border=10, flag=wx.EXPAND|wx.ALL, pos=(1,1))
gb.AddGrowableCol(1)
butsz = wx.StdDialogButtonSizer()
okbut = wx.Button(self, wx.ID_OK, u"OK")
butsz.AddButton(okbut)
cbut = wx.Button(self, wx.ID_CANCEL, u"Cancel")
butsz.AddButton(cbut)
insp = wx.Button(self, wx.ID_HELP, u"Help")
butsz.AddButton(insp)
insp.Bind(wx.EVT_BUTTON, InspectionTool().Show)
butsz.Realize()
okbut.SetDefault()
vsizer.Add(gb, 0, wx.EXPAND)
vsizer.Add(butsz, 0, wx.EXPAND)
self.SetSizer(vsizer)
self.Fit()
def __init__(self, parent):
with iz.Dialog(init=self, title=u"Logon", orient=wx.VERTICAL, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER):
with iz.GridBagSizer(orient=wx.HORIZONTAL, proportion=1) as gb:
# Defaults for StaticText and TextCtrl are normally border=0,proportion=0,flag=0. Change them temporarily
# to avoid repeating the same options for each and every control:
with iz.StaticText.Default(border=10), iz.TextCtrl.Default(border=10, proportion=1, flag=wx.EXPAND):
# Now the sizer parameters can be omitted in the control definitions, since the defaults are
# now appropriate.
iz.StaticText(u"Username")
self._name = iz.TextCtrl().wx
iz.StaticText(u"Password", x=0)
self._pass = iz.TextCtrl(style=wx.TE_PASSWORD).wx
gb.AddGrowableCol(1)
with iz.StdDialogButtonSizer():
okbut = iz.Button(u"OK", id=wx.ID_OK).wx
iz.Button(u"Cancel", id=wx.ID_CANCEL)
insp = iz.Button(u"Help", id=wx.ID_HELP,border=10, EVT_BUTTON=InspectionTool().Show).wx
okbut.SetDefault()
self.Fit()
def create_postorder(self):
prev_x = prev_y = prev_xspan = prev_yspan = 0
for c in self.zchildren:
x,y = c.x,c.y
if x is None and y is None:
x,y = prev_x,prev_y
if self.orient == wx.HORIZONTAL:
x += prev_xspan
elif self.orient == wx.VERTICAL:
y += prev_yspan
else:
raise TypeError('%s position unspecified' % (c,))
elif x is None:
x = prev_x
if y < prev_y + prev_yspan:
x += 1
elif y is None:
y = prev_y
if x < prev_x + prev_xspan:
y += 1
if c.border > 0 and (c.flag & wx.ALL)==0:
c.flag |= wx.ALL
c.sizer_item = self.w.Add(c.sized, (y,x), (c.yspan,c.xspan), c.flag, c.border)
prev_x, prev_y, prev_xspan, prev_yspan = x,y,c.xspan,c.yspan
def __init__(self, controller_uid):
TopLevel.__init__(self, controller_uid)
UIM = UIManager()
controller = UIM.get(self._controller_uid)
wx.Dialog.__init__(self, None, wx.ID_ANY, controller.model.title,
pos=controller.model.pos, size=controller.model.size,
style=controller.model.style
)
self._objects = {}
if controller.model.icon:
self.icon = wx.Icon(controller.model.icon, wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon)
if controller.model.maximized:
self.Maximize()
self.Bind(wx.EVT_MAXIMIZE, self.on_maximize)
self.Bind(wx.EVT_SIZE, self.on_size)
self.Bind(wx.EVT_MOVE, self.on_move)
dialog_box = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(dialog_box)
self.mainpanel = self.AddCreateContainer('BoxSizer', self, proportion=1,
flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND, border=10
)
button_sizer = self.CreateButtonSizer(controller.model.flags)
dialog_box.Add(button_sizer, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10)
dialog_box.Layout()
GUI_wxPython.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 15
收藏 0
点赞 0
评论 0
def createWidgetsFrame(self):
staticBox = wx.StaticBox( self.panel, -1, "Widgets Frame", size=(285, -1) )
self.statBoxSizerV = wx.StaticBoxSizer(staticBox, wx.VERTICAL)
#----------------------------------------------------------
GUI_wxPython.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def createManageFilesFrame(self):
staticBox = wx.StaticBox( self.panel, -1, "Manage Files", size=(285, -1) )
self.statBoxSizerMgrV = wx.StaticBoxSizer(staticBox, wx.VERTICAL)
#----------------------------------------------------------
GUI_wxPython.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def layoutWidgets(self):
boxSizerV = wx.BoxSizer( wx.VERTICAL )
boxSizerV.Add( self.statBoxSizerV, 1, wx.ALL )
boxSizerV.Add( self.statBoxSizerMgrV, 1, wx.ALL )
self.panel.SetSizer( boxSizerV )
boxSizerV.SetSizeHints( self.panel )
#----------------------------------------------------------
GUI_wxPython.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def addStaticBoxWithLabels(self):
boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" )
staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL )
boxSizerV = wx.BoxSizer( wx.VERTICAL )
staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" )
boxSizerV.Add( staticText1, 0, wx.ALL)
staticText2 = wx.StaticText( self.panel, -1, " Label 2")
boxSizerV.Add( staticText2, 0, wx.ALL )
#------------------------------------------------------
staticBoxSizerV.Add( boxSizerV, 0, wx.ALL )
boxSizerH.Add(staticBoxSizerV)
#------------------------------------------------------
boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1)))
#------------------------------------------------------
boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED))
# Add local boxSizer to main frame
self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL )
#----------------------------------------------------------
def __init__(self, parent, run, api):
"""Initialize the RunPanel.
Args:
parent: The parent Window for this panel.
run: The sequencing run that should be displayed.
api: An initialized instance of an API for interacting with IRIDA.
"""
ScrolledPanel.__init__(self, parent, style=wx.SUNKEN_BORDER)
box = wx.StaticBox(self, label=run.sample_sheet_name)
self._timer = wx.Timer(self)
self._run = run
self._progress_value = 0
self._last_progress = 0
self._last_timer_progress = 0
self._sample_panels = {}
# the current overall progress for the run is calculated as a percentage
# of the total file size of all samples in the run.
self._progress_max = sum(sample.get_files_size() for sample in run.samples_to_upload)
logging.info("Total file size for run is {}".format(self._progress_max))
self._sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
pub.subscribe(self._upload_started, run.upload_started_topic)
pub.subscribe(self._handle_progress, run.upload_progress_topic)
pub.subscribe(self._upload_complete, run.upload_completed_topic)
pub.subscribe(self._upload_failed, run.upload_failed_topic)
for sample in run.sample_list:
self._sample_panels[sample.get_id()] = SamplePanel(self, sample, run, api)
self._sizer.Add(self._sample_panels[sample.get_id()], flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
self.SetSizer(self._sizer)
self.Bind(wx.EVT_TIMER, self._update_progress_timer, self._timer)
self.Layout()
self.SetupScrolling()