Hi,
Why does a button post even if it has not been gbox.Added?
It posts in the upper left. I"m on a Mac running 10.5.
paul
···
----
import wx, sys, os
class TestFrame(wx.Frame):
def __init__(self, parent, id, title, size=(500,500)):
self.parent = parent
wx.Frame.__init__(self, parent, wx.NewId(), title, size=(480, 380))
_id_ = wx.NewId()
self.operator = "Shem O. Wandiga"
self.location = "Otjikondo, Etosha NP, Zambia"
self.operator_tc = wx.TextCtrl(self, _id_, self.operator, size=(200, -1))
self.location_tc = wx.TextCtrl(self, _id_, self.location, size=(200, -1))
filter_btn_id = _id_
filter_btn = wx.Button(self, filter_btn_id, 'Filter')
rows = 2
cols = 2
gbox = wx.FlexGridSizer(rows, cols, 4, 4)
stretch=1
gbox.Add(wx.StaticText(self, 200, "operator", size=(200, -1), style=wx.ALIGN_RIGHT))
gbox.Add(self.operator_tc, stretch, wx.ALIGN_CENTRE)
gbox.Add(wx.StaticText(self, 201, "location", size=(200, -1), style=wx.ALIGN_RIGHT))
gbox.Add(self.location_tc, stretch, wx.ALIGN_CENTRE)
#gbox.Add(filter_btn) # xxx OUT. posts anyway...
#gbox.Add(saveXML_btn) # xxx OUT
self.SetSizer(gbox)
gbox.SetSizeHints(self)
self.Centre()
def OnUpdateModel(self, event):
print "<snip>"
def OnFilter(self, event):
self.OnUpdateModel()
import numpy as np
#path = self.imagepath_tc.GetValue()
path = "8bitchart01_small.tiff" # smack it
if os.path.exists(path):
image = wx.Image(path, wx.BITMAP_TYPE_ANY)
w, h = image.GetWidth(), image.GetHeight()
a = np.fromstring(image.GetData(), np.uint8)
a.reshape(w, h, 3)
"""thanks to Stephan van der Walt"""
RED, GRN, BLU = 0, 1, 2
bluemask = (a[...,BLU] > fact*a[...,GRN]) & \
(a[...,BLU] > fact*a[...,RED])
return np.array(bluemask.nonzero()).swapaxes(0,1).tolist()
else:
print "file not found..."
def OnSaveXML(self, event):
self.OnUpdateModel()
#print self.meta.getXML()
print "<snip/>"
if __name__ == "__main__":
app = wx.App()
TestFrame(None, -1, 'MetadataPanel.py').Show(True)
app.MainLoop()