def _create_images(self): underline = wx.Image(get_image_path('underline.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() un_image = wx.StaticBitmap(self, wx.ID_ANY, underline, size=(underline.GetWidth(), underline.GetHeight())) self.un_image = un_image self.un_image.Bind(wx.EVT_LEFT_DOWN, self.on_click) left_bar = wx.Image(get_image_path('left_bar.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() lb_image = wx.StaticBitmap(self, wx.ID_ANY, left_bar, size=(left_bar.GetWidth(), left_bar.GetHeight())) self.lb_image = lb_image self.lb_image.Bind(wx.EVT_LEFT_DOWN, self.on_click)
def _setup_buttons(self): button_sizer = wx.BoxSizer(orient=wx.HORIZONTAL) self.run_strategy_button = wx.Button(self, label=pt.RUN_STRATEGY) self.run_stage_button = wx.Button(self, label="run stage button") down_arrow = wx.Image(get_image_path("down_arrow.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() da_image = wx.StaticBitmap(self, wx.ID_ANY, down_arrow, size=(down_arrow.GetWidth(), down_arrow.GetHeight())) button_sizer.Add(da_image) button_sizer.Add(self.run_strategy_button, proportion=0, flag=wx.ALL, border=3) button_sizer.Add((6, 6)) button_sizer.Add(self.run_stage_button, proportion=1, flag=wx.ALL, border=3) self.button_sizer = button_sizer
def set_image_positions(self): ss = self.GetSize() if hasattr(self, 'ss') and ss == self.ss: return else: self.ss = self.GetSize() uns = self.un_image.GetSize() self.un_image.SetPosition((0, ss[1]-uns[1])) lbs = self.lb_image.GetSize() left_bar = wx.Image(get_image_path('left_bar.png'), wx.BITMAP_TYPE_PNG).Scale(lbs[0], ss[1]).ConvertToBitmap() self.lb_image.SetBitmap(left_bar) self.lb_image.SetPosition((0, 0)) self.lb_image.SetSize((left_bar.GetWidth(), left_bar.GetHeight()))
app = wx.App(redirect=False) app.SetAppName("spikepy") # create a spikepy session from spikepy.session import Session session = Session() if __name__ == '__main__': from spikepy.common.path_utils import get_image_path class MySplashScreen(wx.SplashScreen): def __init__(self, image=None, splash_style=None, timeout=None, parent=None, **kwargs): wx.SplashScreen.__init__(self, image, splash_style, timeout, parent, **kwargs) def startup(): ''' Run after splash screen has loaded ''' from spikepy.gui.controller import Controller controller = Controller(session, print_messages=print_messages) wx.CallLater(1000, splash_screen.Destroy) image = wx.Image(get_image_path('spikepy_splash.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap() splash_screen = MySplashScreen(image=image, splash_style=wx.SPLASH_CENTRE_ON_SCREEN, timeout=1000, parent=None) wx.CallLater(200, startup) app.MainLoop()