Python wx.StaticBitmap() Examples

The following are 30 code examples of wx.StaticBitmap(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, size=(-1, -1), pic_path=None, display=0):
        wx.Frame.__init__(
            self,
            None,
            -1,
            "ShowPictureFrame",
            style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR  #| wx.STAY_ON_TOP
        )
        self.SetBackgroundColour(wx.Colour(0, 0, 0))
        self.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        bitmap = wx.EmptyBitmap(1, 1)
        self.staticBitmap = wx.StaticBitmap(self, -1, bitmap)
        self.staticBitmap.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
        self.staticBitmap.Bind(wx.EVT_MOTION, self.ShowCursor)
        self.timer = Timer(2.0, self.HideCursor) 
Example #2
Source File: StatusLight.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, wxid=wx.ID_ANY):
        images = {}
        tips = {}
        a = wx.GetApp()
        for k in self.states.keys():
            i = a.theme_library.get(('statuslight', self.states[k][0]))
            b = wx.BitmapFromImage(i)
            images[k] = b

        _StatusLight.__init__(self)
        wx.Panel.__init__(self, parent, id=wxid, style=wx.NO_BORDER)
        self.SetSize(wx.Size(24,24))
        self.bitmap = wx.StaticBitmap(self, wx.ID_ANY)

        self.images = images
        self.tips = tips

        self.Fit()

        self.change_state() 
Example #3
Source File: welcome.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, gui_size):
        h = gui_size[0]
        w = gui_size[1]
        wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER, size=(h, w))

        ##         design the panel
        sizer = wx.GridBagSizer(10, 7)
        # Add image of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(dlc))
        sizer.Add(icon, pos=(0, 0), span=(0, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
        line = wx.StaticLine(self)
        sizer.Add(line, pos=(1, 0), span=(1, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)

        # if editing this text make sure you add the '\n' to get the new line. The sizer is unable to format lines correctly.
        description = "DeepLabCut™ is an open source tool for markerless\npose estimation of user-defined body parts with deep learning.\nA. and M.W. Mathis Labs | http://www.deeplabcut.org\n \nWelcome to the DeepLabCut Project Manager GUI!\nTo get started, please click on the 'Manage Project'\n tab to create or load an existing project. \n "

        self.proj_name = wx.StaticText(self, label=description, style=wx.ALIGN_CENTRE)
        sizer.Add(self.proj_name, pos=(2, 3), border=10)
        sizer.AddGrowableCol(2)
        self.SetSizer(sizer)
        sizer.Fit(self) 
Example #4
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 6 votes vote down vote up
def __init__(self, parent):
        # TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
        wx.Dialog.__init__(self, parent, title="SCT Processing")
        self.SetSize((300, 120))

        vbox = wx.BoxSizer(wx.VERTICAL)
        lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
        vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
        vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        # TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
        save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
        img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))

        hbox.Add(img_info, 0, wx.ALL, 10)
        hbox.Add(vbox, 0, wx.ALL, 0)

        self.SetSizer(hbox)
        self.Centre()
        self.CenterOnParent()
        # TODO: retrieve action from the cancel button 
Example #5
Source File: ImagePicker.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, label, title="", mesg="", imageString=None):
        self.title = title
        self.mesg = mesg
        self.imageString = imageString
        wx.Window.__init__(self, parent, -1)
        self.button = wx.Button(self, -1, label)
        self.imageBox = wx.StaticBitmap(
            self, -1, size=(10, 10), style=wx.SUNKEN_BORDER
        )
        self.SetValue(imageString)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.button, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
        sizer.Add(self.imageBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        self.SetSizer(sizer)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.Layout() 
Example #6
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def launchFileDialog(self, evt):
        # defining wildcard for suppported picture formats
        wildcard = "JPEG (*.jpg)|*.jpg|" \
                   "PNG (*.png)|*.png|" \
                   "GIF (*.gif)|*.gif"
        # defining the dialog object
        dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
                               wildcard=wildcard,
                               style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
        # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
        if dialog.ShowModal() == wx.ID_OK:
            self.magic_collection[1].SetValue(
                "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
            paths = dialog.GetPaths()

            # This adds the selected picture to the Right region. Right region object is retrieved from UI object array
            modification_bitmap1 = wx.Bitmap(paths[0])
            modification_image1 = modification_bitmap1.ConvertToImage()
            modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
            modification_bitmap2 = modification_image1.ConvertToBitmap()
            report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))

            self.processPicture(paths[0],
                                "PROGRAM_INSTALL_FULLPATH\\inception_v3_weights_tf_dim_ordering_tf_kernels.h5",
                                "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json") 
Example #7
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def launchFileDialog(self, evt):
        # defining wildcard for suppported picture formats
        wildcard = "JPEG (*.jpg)|*.jpg|" \
                   "PNG (*.png)|*.png|" \
                   "GIF (*.gif)|*.gif"
        # defining the dialog object
        dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
                               wildcard=wildcard,
                               style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
        # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
        if dialog.ShowModal() == wx.ID_OK:
            self.magic_collection[1].SetValue(
                "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
            paths = dialog.GetPaths()

            # This adds the selected picture to the Right region. Right region object is retrieved from UI object array
            modification_bitmap1 = wx.Bitmap(paths[0])
            modification_image1 = modification_bitmap1.ConvertToImage()
            modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
            modification_bitmap2 = modification_image1.ConvertToBitmap()
            report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))

            self.processPicture(paths[0],
                                "PROGRAM_INSTALL_FULLPATH\\DenseNet-BC-121-32.h5",
                                "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json") 
Example #8
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def launchFileDialog(self, evt):
        # defining wildcard for suppported picture formats
        wildcard = "JPEG (*.jpg)|*.jpg|" \
                   "PNG (*.png)|*.png|" \
                   "GIF (*.gif)|*.gif"
        # defining the dialog object
        dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
                               wildcard=wildcard,
                               style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
        # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
        if dialog.ShowModal() == wx.ID_OK:
            self.magic_collection[1].SetValue(
                "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
            paths = dialog.GetPaths()

            # This adds the selected picture to the Right region. Right region object is retrieved from UI object array
            modification_bitmap1 = wx.Bitmap(paths[0])
            modification_image1 = modification_bitmap1.ConvertToImage()
            modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
            modification_bitmap2 = modification_image1.ConvertToBitmap()
            report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))

            self.processPicture(paths[0],
                                "PROGRAM_INSTALL_FULLPATH\\squeezenet_weights_tf_dim_ordering_tf_kernels.h5",
                                "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json") 
Example #9
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def launchFileDialog(self, evt):
        # defining wildcard for suppported picture formats
        wildcard = "JPEG (*.jpg)|*.jpg|" \
                   "PNG (*.png)|*.png|" \
                   "GIF (*.gif)|*.gif"
        # defining the dialog object
        dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
                               wildcard=wildcard,
                               style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
        # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
        if dialog.ShowModal() == wx.ID_OK:
            self.magic_collection[1].SetValue(
                "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
            paths = dialog.GetPaths()

            # This adds the selected picture to the Right region. Right region object is retrieved from UI object array
            modification_bitmap1 = wx.Bitmap(paths[0])
            modification_image1 = modification_bitmap1.ConvertToImage()
            modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
            modification_bitmap2 = modification_image1.ConvertToBitmap()
            report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))

            self.processPicture(paths[0],
                                "PROGRAM_INSTALL_FULLPATH\\resnet50_weights_tf_dim_ordering_tf_kernels.h5",
                                "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json") 
Example #10
Source File: imageutil.py    From me-ica with GNU Lesser General Public License v2.1 5 votes vote down vote up
def resize_bitmap(parent, _bitmap, target_height):
  '''
  Resizes a bitmap to a height of 89 pixels (the
  size of the top panel), while keeping aspect ratio
  in tact
  '''
  image = wx.ImageFromBitmap(_bitmap)
  _width, _height = image.GetSize()
  if _height < target_height:
    return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
  ratio = float(_width) / _height
  image = image.Scale(target_height * ratio, target_height, wx.IMAGE_QUALITY_HIGH)
  return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image)) 
Example #11
Source File: local_display.py    From Pigrow with GNU General Public License v3.0 5 votes vote down vote up
def display_image(self, path_to_image):
        #img_bmp = wx.StaticBitmap(self, -1, wx.Image(path_to_image, wx.BITMAP_TYPE_ANY).ConvertToBitmap()), 0, wx.ALL, 2)
        bitmap = wx.Bitmap(1, 1)
        bitmap.LoadFile(path_to_image, wx.BITMAP_TYPE_ANY)
        self.img_bmp_box.SetBitmap(bitmap)
        MainApp.window_self.Layout() 
Example #12
Source File: local_display.py    From Pigrow with GNU General Public License v3.0 5 votes vote down vote up
def __init__( self, parent ):
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, style = wx.TAB_TRAVERSAL )
        # timer
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        # Tab Title
        title_l = wx.StaticText(self,  label='Live Display', size=(-1,40))
        title_l.SetBackgroundColour((50,250,250))
        title_l.SetFont(shared_data.title_font)
        self.toggleBtn = wx.Button(self, wx.ID_ANY, "Start")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle)
        bitmap = wx.Bitmap(1, 1)
        #bitmap.LoadFile(pic_one, wx.BITMAP_TYPE_ANY)
        size = bitmap.GetSize()
        self.img_bmp_box = wx.StaticBitmap(self, -1, bitmap, size=(size[0], size[1]))


        # sizers
        self.image_sizer = wx.BoxSizer(wx.VERTICAL)
        self.image_sizer.Add(self.img_bmp_box, 0, wx.EXPAND, 3)

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(title_l, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
        main_sizer.Add(self.toggleBtn, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
        main_sizer.Add(self.image_sizer, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 3)
        self.SetSizer(main_sizer) 
Example #13
Source File: ConfTreeNodeEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, ID, bitmapname,
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=0,
                 name="genstatbmp"):

        bitmap = GetBitmap(bitmapname)
        if bitmap is None:
            bitmap = wx.EmptyBitmap(0, 0)

        wx.StaticBitmap.__init__(self, parent, ID,
                                 bitmap,
                                 pos, size,
                                 style,
                                 name) 
Example #14
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(
        self,
        parent,
        message,
    ):
        if parent is None and eg.document.frame:
            parent = eg.document.frame
        wx.Frame.__init__(self, parent, -1, eg.APP_NAME, wx.DefaultPosition, style=wx.RAISED_BORDER| wx.STAY_ON_TOP)
        self.SetBackgroundColour(wx.NullColour)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        bmp = wx.ArtProvider.GetBitmap(wx.ART_WARNING, wx.ART_CMN_DIALOG, (32, 32))
        staticBitmap = wx.StaticBitmap(self, -1, bmp)
        staticBitmap2 = wx.StaticBitmap(self, -1, bmp)
        staticText = wx.StaticText(self, -1, message)
        fnt = staticText.GetFont()
        fnt.SetPointSize(13)
        staticText.SetFont(fnt)
        sizer.Add(staticBitmap, 0, wx.ALL, 12)
        sizer.Add(staticText,0,wx.ALIGN_CENTER)
        sizer.Add(staticBitmap2, 0, wx.ALL, 12)
        self.SetSizerAndFit(sizer)
        self.CenterOnParent()
        self.Show()
        self.Update()
#=============================================================================== 
Example #15
Source File: viewer_low_level_util.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def set_scroll_content(self):
        self.img_lst_v_sizer.Clear(True)

        for lst_1d in self.lst_2d_bmp:
            img_lst_hor_sizer = wx.BoxSizer(wx.HORIZONTAL)

            for i, i_bmp in enumerate(lst_1d):
                local_bitmap = wx.StaticBitmap(self, bitmap=i_bmp)
                if self.parent_panel.local_bbox is None:
                    slice_string = "Slice[" + str(i) + ":" + str(i + 1) + ", :, :]"
                else:
                    bbx = self.parent_panel.local_bbox
                    slice_string = "Image # " + str(bbx[4] + i)

                slice_sub_info_txt = wx.StaticText(self, -1, slice_string)

                sigle_slice_sizer = wx.BoxSizer(wx.VERTICAL)
                sigle_slice_sizer.Clear(True)

                sigle_slice_sizer.Add(
                    local_bitmap, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=2
                )
                sigle_slice_sizer.Add(
                    slice_sub_info_txt,
                    proportion=0,
                    flag=wx.ALIGN_CENTRE | wx.ALL,
                    border=2,
                )
                img_lst_hor_sizer.Add(
                    sigle_slice_sizer,
                    proportion=0,
                    flag=wx.ALIGN_CENTER | wx.ALL,
                    border=2,
                )

            self.img_lst_v_sizer.Add(img_lst_hor_sizer, 0, wx.CENTER | wx.ALL, 10)

            self.n_img += 1

        self.parent_panel.Pframe.Layout()
        self.SetScrollRate(1, 1) 
Example #16
Source File: StatusBar.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, -1)
        self.sizeChanged = False
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        self.SetFieldsCount(2)
        self.SetStatusWidths([-1, 40])
        self.icons = [
            GetInternalBitmap("Tray1"),
            GetInternalBitmap("Tray3"),
            GetInternalBitmap("Tray2"),
        ]
        self.icon = wx.StaticBitmap(self, -1, self.icons[0], (0, 0), (16, 16))
        rect = self.GetFieldRect(0)

        checkBox = wx.CheckBox(self, -1, eg.text.MainFrame.onlyLogAssigned)
        self.checkBox = checkBox
        colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        checkBox.SetBackgroundColour(colour)
        self.checkBoxColour = checkBox.GetForegroundColour()
        checkBox.SetValue(eg.config.onlyLogAssigned)
        self.SetCheckBoxColour(eg.config.onlyLogAssigned)
        checkBox.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
        checkBox.SetPosition((rect.x + 2, rect.y + 2))
        checkBox.SetToolTipString(eg.text.MainFrame.onlyLogAssignedToolTip)

        eg.Bind("ProcessingChange", self.OnProcessingChange)
        self.Reposition() 
Example #17
Source File: main.py    From python-examples with MIT License 5 votes vote down vote up
def InitUI(self):
            
        img_color = wx.Image('Obrazy/furas.png')
        img_grey = img_color.ConvertToGreyscale(0.3, 0.3, 0.3)
        
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        
        self.panel = wx.Panel(self)
        self.panel.SetSizer(self.hbox)

        self.bitmap_color = wx.Bitmap(img_color)
        self.bitmap_grey = wx.Bitmap(img_grey)

        #self.image = wx.StaticBitmap(self.panel, 1, self.bitmap_color)
        self.image = wx.BitmapButton(self.panel, 1, self.bitmap_color, style=wx.BORDER_NONE)
        # use 0 to not resize image to full window        
        self.hbox.Add(self.image, 0)

        # binds don't work on Linux for StaticBitmap
        # but they works for BitmapButton (but Button has border)
        self.image.Bind(wx.EVT_ENTER_WINDOW, self.OnOver)
        self.image.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)

        # set color to see how many space use it
        self.panel.SetBackgroundColour((0,255,0))
        # set color to see how many space use it
        self.image.SetBackgroundColour((255,0,0)) 
Example #18
Source File: main_frame.py    From Rule-based_Expert_System with GNU General Public License v2.0 5 votes vote down vote up
def show_picture(self, path, pos):
        pic = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        bmp = wx.StaticBitmap(self, 0, pic, pos=pos)
        bmp.Show() 
Example #19
Source File: static_bitmap.py    From wxGlade with MIT License 5 votes vote down vote up
def create_widget(self):
        bmp = self.get_preview_obj_bitmap()
        self.widget = wx.StaticBitmap(self.parent_window.widget, self.id, bmp)
        if wx.Platform == '__WXMSW__':
            def get_best_size():
                bmp = self.widget.GetBitmap()
                if bmp and bmp.IsOk():
                    return bmp.GetWidth(), bmp.GetHeight()
                return wx.StaticBitmap.GetBestSize(self.widget)
            self.widget.GetBestSize = get_best_size 
Example #20
Source File: msgdialog.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MessageDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        bmp = compat.wx_ArtProvider_GetBitmap(wx.ART_TIP, wx.ART_MESSAGE_BOX, (48, 48))
        self.msg_image = wx.StaticBitmap(self, wx.ID_ANY, bmp)
        self.msg_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_NO_HEADER | wx.LC_REPORT | wx.LC_SINGLE_SEL)
        self.OK = wx.Button(self, wx.ID_OK, "")
        # properties
        self.SetTitle(_("wxGlade Message"))
        self.msg_image.SetMinSize((48, 48))
        self.OK.SetFocus()
        self.OK.SetDefault()
        # layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        msg_title = wx.StaticText(self, wx.ID_ANY, _("wxGlade Message"))
        msg_title.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        sizer_1.Add(msg_title, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)
        sizer_2.Add(self.msg_image, 0, 0, 0)
        sizer_2.Add(self.msg_list, 1, wx.EXPAND | wx.LEFT, 10)
        sizer_1.Add(sizer_2, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        sizer_1.Add(self.OK, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre() 
Example #21
Source File: gui.py    From four_flower with MIT License 5 votes vote down vote up
def initimage(self, name):
        imageShow = wx.Image(name, wx.BITMAP_TYPE_ANY)
        sb = wx.StaticBitmap(self.pnl, -1, imageShow.ConvertToBitmap(), pos=(0,30), size=(600,400))
        return sb 
Example #22
Source File: last_result.py    From IkaLog with Apache License 2.0 5 votes vote down vote up
def draw_image(self):
        if not self.result_image or not self.frame:
            return
        wx.StaticBitmap(self.frame, wx.ID_ANY, self.result_image,
                        (0, 0), self.size) 
Example #23
Source File: about.py    From nuxhash with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, *args, **kwargs):
        wx.Panel.__init__(self, parent, *args, **kwargs)
        h_sizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        self.SetSizer(h_sizer)
        v_sizer = wx.BoxSizer(orient=wx.VERTICAL)
        h_sizer.Add(v_sizer, wx.SizerFlags().Proportion(1.0)
                                            .Align(wx.ALIGN_CENTER))

        with open(LOGO_PATH, 'rb') as f:
            logo = wx.Image(f, type=wx.BITMAP_TYPE_PNG)
        v_sizer.Add(wx.StaticBitmap(self, bitmap=wx.Bitmap(logo)),
                    wx.SizerFlags().Align(wx.ALIGN_CENTER))

        v_sizer.AddSpacer(15)

        appName = wx.StaticText(
                self, label=f'nuxhash {__version__}', style=wx.ALIGN_CENTER)
        appName.SetFont(self.GetFont().Scale(2.0))
        v_sizer.Add(appName, wx.SizerFlags().Expand())

        v_sizer.AddSpacer(15)

        v_sizer.Add(wx.StaticText(self, label='A NiceHash client for Linux.',
                                  style=wx.ALIGN_CENTER),
                    wx.SizerFlags().Expand())

        v_sizer.AddSpacer(15)

        copyright = wx.StaticText(self, label=__copyright__, style=wx.ALIGN_CENTER)
        copyright.SetFont(self.GetFont().Scale(0.8))
        v_sizer.Add(copyright, wx.SizerFlags().Expand())

        v_sizer.AddSpacer(30)

        links = wx.BoxSizer(orient=wx.HORIZONTAL)
        links.Add(HyperLinkCtrl(self, label='Website', URL=WEBSITE))
        links.AddSpacer(30)
        links.Add(HyperLinkCtrl(self, label='License', URL=LICENSE))
        v_sizer.Add(links, wx.SizerFlags().Align(wx.ALIGN_CENTER)) 
Example #24
Source File: mainframe.py    From youtube-dl-gui with The Unlicense 5 votes vote down vote up
def _create_static_bitmap(self, icon, event_handler=None):
        static_bitmap = wx.StaticBitmap(self._panel, bitmap=icon)

        if event_handler is not None:
            static_bitmap.Bind(wx.EVT_LEFT_DCLICK, event_handler)

        return static_bitmap 
Example #25
Source File: gui.py    From reading-frustum-pointnets-code with Apache License 2.0 5 votes vote down vote up
def initimage(self, name):
        imageShow = wx.Image(name, wx.BITMAP_TYPE_ANY)
        sb = wx.StaticBitmap(self.pnl, -1, imageShow.ConvertToBitmap(), pos=(0,30), size=(600,400))
        return sb 
Example #26
Source File: imageutil.py    From Gooey with MIT License 5 votes vote down vote up
def wrapBitmap(im, parent):
    try:
        rgba = im.convert('RGBA').tobytes()
    except AttributeError:
        rgba = im.convert('RGBA').tostring()

    bitmapData = bitmapFromBufferRGBA(im, rgba)
    return wx.StaticBitmap(parent, bitmap=bitmapData) 
Example #27
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 5 votes vote down vote up
def get_logo(self):
        logo_file = os.path.join(os.environ[self.SCT_DIR_ENV],
                                 self.SCT_LOGO_REL_PATH)
        png = wx.Image(logo_file,
                       wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        img_logo = wx.StaticBitmap(self, -1, png, wx.DefaultPosition,
                                   (png.GetWidth(), png.GetHeight()))
        return img_logo 
Example #28
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def draw_displays(self, use_ppi_px = False, use_multi_image = False):
        work_sz = self.GetSize()

        # draw canvas
        bmp_canv = wx.Bitmap.FromRGBA(self.dtop_canvas_relsz[0], self.dtop_canvas_relsz[1], red=0, green=0, blue=0, alpha=255)
        if not self.preview_img_list:
            # preview StaticBitmaps don't exist yet
            self.bmp_list.append(bmp_canv)
            self.st_bmp_canvas = wx.StaticBitmap(self, wx.ID_ANY, bmp_canv)
            self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
            self.st_bmp_canvas.Hide()

            # draw monitor previews
            for disp in self.display_rel_sizes:
                size = disp[0]
                offs = disp[1]
                bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
                self.bmp_list.append(bmp)
                st_bmp = wx.StaticBitmap(self, wx.ID_ANY, bmp)
                st_bmp.Hide()
                # st_bmp.SetScaleMode(wx.Scale_AspectFill)  # New in wxpython 4.1
                st_bmp.SetPosition(offs)
                self.preview_img_list.append(st_bmp)
        else:
            # previews exist and should be blanked
            self.current_preview_images = [] # drop chached image list

            self.st_bmp_canvas.SetBitmap(bmp_canv)
            self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
            # self.st_bmp_canvas.Hide()

            # blank monitor previews
            for disp, st_bmp in zip(self.display_rel_sizes, self.preview_img_list):
                size = disp[0]
                offs = disp[1]
                bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
                st_bmp.SetBitmap(bmp)
                st_bmp.SetPosition(offs)
                # st_bmp.Hide()
        self.draw_monitor_numbers(use_ppi_px)
        self.Refresh() 
Example #29
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 5 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title="SCT Error")
        self.SetSize((510, 170))

        vbox = wx.BoxSizer(wx.VERTICAL)
        lbldesc = wx.StaticText(self,
                                id=-1,
                                label="An error has occurred while running SCT. Please go to the Terminal, copy all "
                                      "the content and paste it as a new issue in SCT's forum: \n"
                                      "http://forum.spinalcordmri.org/",
                                size=wx.Size(470, 60),
                                style=wx.ALIGN_LEFT)
        vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        btns = self.CreateSeparatedButtonSizer(wx.OK)
        vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        save_ico = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (50, 50))
        img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))

        hbox.Add(img_info, 0, wx.ALL, 10)
        hbox.Add(vbox, 0, wx.ALL, 0)

        self.SetSizer(hbox)
        self.Centre()
        self.CenterOnParent() 
Example #30
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def bezel_button_positions(self, st_bmp):
        """Return the mid points on the screen of the right and bottom edges
        of the given StaticBitmap."""
        sz = st_bmp.GetSize()
        pos = st_bmp.GetPosition()
        bsz = self.bez_butt_sz
        pos_rb = (sz[0] + pos[0] - bsz[0]/2, sz[1]/2 + pos[1] - bsz[1]/2)
        pos_bb = (sz[0]/2 + pos[0] - bsz[0]/2, sz[1] + pos[1] - bsz[1]/2)
        return [pos_rb, pos_bb]