Python wx.BITMAP_TYPE_PNG Examples

The following are 30 code examples of wx.BITMAP_TYPE_PNG(). 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 7 votes vote down vote up
def __init__(self, parent, id, evtList, ix, plugin):
        width = 205
        wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT |
            wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, size = (width, -1))
        self.parent = parent
        self.id = id
        self.evtList = evtList
        self.ix = ix
        self.plugin = plugin
        self.sel = -1
        self.il = wx.ImageList(16, 16)
        self.il.Add(wx.BitmapFromImage(wx.Image(join(eg.imagesDir, "event.png"), wx.BITMAP_TYPE_PNG)))
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
        self.InsertColumn(0, '')
        self.SetColumnWidth(0, width - 5 - SYS_VSCROLL_X)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect)
        self.Bind(wx.EVT_SET_FOCUS, self.OnChange)
        self.Bind(wx.EVT_LIST_INSERT_ITEM, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick)
        self.SetToolTipString(self.plugin.text.toolTip) 
Example #2
Source File: application.py    From Gooey with MIT License 6 votes vote down vote up
def layoutComponent(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.header, 0, wx.EXPAND)
        sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)

        sizer.Add(self.navbar, 1, wx.EXPAND)
        sizer.Add(self.console, 1, wx.EXPAND)
        sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
        sizer.Add(self.footer, 0, wx.EXPAND)
        self.SetMinSize((400, 300))
        self.SetSize(self.buildSpec['default_size'])
        self.SetSizer(sizer)
        self.console.Hide()
        self.Layout()
        if self.buildSpec.get('fullscreen', True):
            self.ShowFullScreen(True)
        # Program Icon (Windows)
        icon = wx.Icon(self.buildSpec['images']['programIcon'], wx.BITMAP_TYPE_PNG)
        self.SetIcon(icon)
        if sys.platform != 'win32':
            # OSX needs to have its taskbar icon explicitly set
            # bizarrely, wx requires the TaskBarIcon to be attached to the Frame
            # as instance data (self.). Otherwise, it will not render correctly.
            self.taskbarIcon = TaskBarIcon(iconType=wx.adv.TBI_DOCK)
            self.taskbarIcon.SetIcon(icon) 
Example #3
Source File: chronolapse.py    From chronolapse with MIT License 6 votes vote down vote up
def saveImage(self, bmp, filename, folder, prefix, format='jpg'):
        # convert
        img = bmp.ConvertToImage()

        # save
        if format == 'gif':
            fileName = os.path.join(folder,"%s%s.gif" % (prefix, filename))
            img.SaveFile(fileName, wx.BITMAP_TYPE_GIF)

        elif format == 'png':
            fileName = os.path.join(folder,"%s%s.png" % (prefix, filename))
            img.SaveFile(fileName, wx.BITMAP_TYPE_PNG)

        else:
            fileName = os.path.join(folder,"%s%s.jpg" % (prefix, filename))
            img.SaveFile(fileName, wx.BITMAP_TYPE_JPEG) 
Example #4
Source File: GoSyncController.py    From gosync with GNU General Public License v2.0 6 votes vote down vote up
def OnAbout(self, evt):
        """About GoSync"""
        if wxgtk4 :
            about = wx.adv.AboutDialogInfo()
        else:
            about = wx.AboutDialogInfo()
        about.SetIcon(wx.Icon(ABOUT_ICON, wx.BITMAP_TYPE_PNG))
        about.SetName(APP_NAME)
        about.SetVersion(APP_VERSION)
        about.SetDescription(APP_DESCRIPTION)
        about.SetCopyright(APP_COPYRIGHT)
        about.SetWebSite(APP_WEBSITE)
        about.SetLicense(APP_LICENSE)
        about.AddDeveloper(APP_DEVELOPER)
        about.AddArtist(ART_DEVELOPER)
        if wxgtk4 :
            wx.adv.AboutBox(about)
        else:
            wx.AboutBox(about) 
Example #5
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 #6
Source File: __init__.py    From InteractiveHtmlBom with MIT License 5 votes vote down vote up
def check_for_bom_button():
    # From Miles McCoo's blog
    # https://kicad.mmccoo.com/2017/03/05/adding-your-own-command-buttons-to-the-pcbnew-gui/
    def find_pcbnew_window():
        windows = wx.GetTopLevelWindows()
        pcbneww = [w for w in windows if "pcbnew" in w.GetTitle().lower()]
        if len(pcbneww) != 1:
            return None
        return pcbneww[0]

    def callback(_):
        plugin.Run()

    path = os.path.dirname(__file__)
    while not wx.GetApp():
        time.sleep(1)
    bm = wx.Bitmap(path + '/icon.png', wx.BITMAP_TYPE_PNG)
    button_wx_item_id = 0

    from pcbnew import ID_H_TOOLBAR
    while True:
        time.sleep(1)
        pcbnew_window = find_pcbnew_window()
        if not pcbnew_window:
            continue

        top_tb = pcbnew_window.FindWindowById(ID_H_TOOLBAR)
        if button_wx_item_id == 0 or not top_tb.FindTool(button_wx_item_id):
            top_tb.AddSeparator()
            button_wx_item_id = wx.NewId()
            top_tb.AddTool(button_wx_item_id, "iBOM", bm,
                           "Generate interactive BOM", wx.ITEM_NORMAL)
            top_tb.Bind(wx.EVT_TOOL, callback, id=button_wx_item_id)
            top_tb.Realize() 
Example #7
Source File: backend_wx.py    From ImageFusion with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #8
Source File: main.py    From GraphLayout with MIT License 5 votes vote down vote up
def create_bitmap(path, max_width, max_height, edges):
    app = wx.App(None)
    nodes = layout.layout(edges)
    bitmap = render.render(max_width, max_height, edges, nodes)
    bitmap.SaveFile(path, wx.BITMAP_TYPE_PNG) 
Example #9
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 #10
Source File: __init__.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def get(self, key, size=None, base=None, ext='.png'):
        if self._data.has_key((key, size)):
            return self._data[(key, size)]

        name = self.resolve_filename(key, size, base, ext)

        i = wx.Image(name, wx.BITMAP_TYPE_PNG)
        if not i.Ok():
            raise Exception("The image is not valid: %r" % name)

        self._data[(key, size)] = i

        return i 
Example #11
Source File: backend_wx.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #12
Source File: backend_wx.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #13
Source File: backend_wx.py    From CogAlg with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #14
Source File: Icons.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def GetInternalImage(name):
    return wx.Image(join(eg.imagesDir, name + ".png"), wx.BITMAP_TYPE_PNG) 
Example #15
Source File: TaskBarIcon.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, show):
        self.stateIcons = (
            wx.Icon(join(eg.imagesDir, "Tray1.png"), wx.BITMAP_TYPE_PNG),
            wx.Icon(join(eg.imagesDir, "Tray3.png"), wx.BITMAP_TYPE_PNG),
            wx.Icon(join(eg.imagesDir, "Tray2.png"), wx.BITMAP_TYPE_PNG),
        )
        self.tooltip = eg.APP_NAME + " " + eg.Version.string
        wx.TaskBarIcon.__init__(self)
        # SetIcon *must* be called immediately after creation, as otherwise
        # it won't appear on Vista restricted user accounts. (who knows why?)
        if show:
            self.Show()
        self.currentEvent = None
        self.processingEvent = None
        self.currentState = 0
        self.reentrantLock = threading.Lock()
        eg.Bind("ProcessingChange", self.OnProcessingChange)
        menu = self.menu = wx.Menu()
        text = eg.text.MainFrame.TaskBarMenu
        menu.Append(ID_SHOW, text.Show)
        menu.Append(ID_HIDE, text.Hide)
        menu.AppendSeparator()
        menu.Append(ID_EXIT, text.Exit)
        self.Bind(wx.EVT_MENU, self.OnCmdShow, id=ID_SHOW)
        self.Bind(wx.EVT_MENU, self.OnCmdHide, id=ID_HIDE)
        self.Bind(wx.EVT_MENU, self.OnCmdExit, id=ID_EXIT)
        self.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.OnTaskBarMenu)
        self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnCmdShow) 
Example #16
Source File: PLCOpenEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnAboutMenu(self, event):
        info = version.GetAboutDialogInfo()
        info.Name = "PLCOpenEditor"
        info.Description = _("PLCOpenEditor is part of Beremiz project.\n\n"
                             "Beremiz is an ") + info.Description
        info.Icon = wx.Icon(os.path.join(beremiz_dir, "images", "aboutlogo.png"), wx.BITMAP_TYPE_PNG)
        ShowAboutDialog(self, info) 
Example #17
Source File: utils_ui.py    From RF-Monitor with GNU General Public License v2.0 5 votes vote down vote up
def load_bitmap(resource, size=None):
    bitmap = wx.Bitmap(get_resource(resource), wx.BITMAP_TYPE_PNG)
    if size is not None:
        image = wx.ImageFromBitmap(bitmap)
        image.Rescale(size.GetWidth(), size.GetHeight(),
                      wx.IMAGE_QUALITY_HIGH)
        bitmap = image.ConvertToBitmap()

    return bitmap 
Example #18
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def __init__(self, parent_tray_obj):
        wx.Frame.__init__(self, parent=None, title="Superpaper Wallpaper Configuration")
        self.frame_sizer = wx.BoxSizer(wx.VERTICAL)
        config_panel = WallpaperSettingsPanel(self, parent_tray_obj)
        self.frame_sizer.Add(config_panel, 1, wx.EXPAND)
        self.SetAutoLayout(True)
        self.SetSizer(self.frame_sizer)
        self.SetMinSize((600,600))
        self.SetIcon(wx.Icon(TRAY_ICON, wx.BITMAP_TYPE_PNG))
        self.Fit()
        self.Layout()
        self.Center()
        self.Show() 
Example #19
Source File: configuration_dialogs.py    From superpaper with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        wx.Frame.__init__(self, parent=parent, title="Superpaper Help")
        self.frame_sizer = wx.BoxSizer(wx.VERTICAL)
        help_panel = HelpPanel(self)
        self.frame_sizer.Add(help_panel, 1, wx.EXPAND)
        self.SetAutoLayout(True)
        self.SetSizer(self.frame_sizer)
        self.SetIcon(wx.Icon(TRAY_ICON, wx.BITMAP_TYPE_PNG))
        self.Fit()
        self.Layout()
        self.Center()
        self.Show() 
Example #20
Source File: tray.py    From superpaper with MIT License 5 votes vote down vote up
def on_about(self, event):
        """Opens About dialog."""
        # Credit for AboutDiaglog example to Jan Bodnar of
        # http://zetcode.com/wxpython/dialogs/
        description = (
            "Superpaper is an advanced multi monitor wallpaper\n"
            +"manager for Unix and Windows operating systems.\n"
            +"Features include setting a single or multiple image\n"
            +"wallpaper, pixel per inch and bezel corrections,\n"
            +"manual pixel offsets for tuning, slideshow with\n"
            +"configurable file order, multiple path support and more."
            )
        licence = (
            "Superpaper is free software; you can redistribute\n"
            +"it and/or modify it under the terms of the MIT"
            +" License.\n\n"
            +"Superpaper is distributed in the hope that it will"
            +" be useful,\n"
            +"but WITHOUT ANY WARRANTY; without even the implied"
            +" warranty of\n"
            +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
            +"See the MIT License for more details."
            )
        artists = "Icons kindly provided by Icons8 https://icons8.com"

        info = wx.adv.AboutDialogInfo()
        info.SetIcon(wx.Icon(TRAY_ICON, wx.BITMAP_TYPE_PNG))
        info.SetName('Superpaper')
        info.SetVersion(__version__)
        info.SetDescription(description)
        info.SetCopyright('(C) 2020 Henri Hänninen')
        info.SetWebSite('https://github.com/hhannine/Superpaper/')
        info.SetLicence(licence)
        info.AddDeveloper('Henri Hänninen')
        info.AddArtist(artists)
        # info.AddDocWriter('Doc Writer')
        # info.AddTranslator('Tran Slator')
        wx.adv.AboutBox(info) 
Example #21
Source File: backend_wx.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #22
Source File: backend_wx.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #23
Source File: backend_wx.py    From neural-network-animation with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #24
Source File: backend_wx.py    From matplotlib-4-abaqus with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #25
Source File: backend_wx.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #26
Source File: backend_wx.py    From Computable with MIT License 5 votes vote down vote up
def print_png(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs) 
Example #27
Source File: yamled.py    From report-ng with GNU General Public License v2.0 5 votes vote down vote up
def About(self, e):
        dialog = wx.AboutDialogInfo()
        #dialog.SetIcon (wx.Icon('icon.ico', wx.BITMAP_TYPE_PNG))
        dialog.SetIcon(self.icon)
        #dialog.SetName(self.application.long_title+' - '+self.application.title)
        dialog.SetName('Yaml Editor - Yamled')
        dialog.SetVersion(self.application.version)
        dialog.SetCopyright(self.application.c)
        #dialog.SetDescription('\n'.join(map(lambda x: x[4:], self.application.about.split('\n')[1:][:-1])))
        dialog.SetDescription('\n'.join([
            '',
            'This editor is developed as part of report-ng project.',
            '',
            'It supports only basic functionality.',
            'This include:',
            '- Opening (drag & drop is supported), saving and closing yaml file',
            '- Tree view of yaml structure',
            '- Editing values',
            '- Adding new child node or structure (limited capability)',
            '- Deleting node or subtree',
            '',
            'In other words - the tool is intended to simplify work with yaml files, ',
            'not to allow designing them from scratch.']))
        #dialog.SetWebSite(self.application.url)
        #dialog.SetLicence(self.application.license)
        wx.AboutBox(dialog) 
Example #28
Source File: gui.py    From report-ng with GNU General Public License v2.0 5 votes vote down vote up
def About(self, e):
            dialog = wx.AboutDialogInfo()
            #dialog.SetIcon (wx.Icon('icon.ico', wx.BITMAP_TYPE_PNG))
            dialog.SetIcon(self.icon)
            dialog.SetName(self.application.title+': '+self.application.long_title)
            dialog.SetVersion(self.application.version)
            dialog.SetCopyright(self.application.c)
            dialog.SetDescription('\n'.join(map(lambda x: x[4:], self.application.about.split('\n')[1:][:-1])))

            dialog.SetWebSite(self.application.url)
            dialog.SetLicence(self.application.license)
            wx.AboutBox(dialog) 
Example #29
Source File: MeshCanvas.py    From laplacian-meshes with GNU General Public License v3.0 5 votes vote down vote up
def saveImage(canvas, filename):
    s = wx.ScreenDC()
    w, h = canvas.size.Get()
    b = wx.EmptyBitmap(w, h)
    m = wx.MemoryDCFromDC(s)
    m.SelectObject(b)
    m.Blit(0, 0, w, h, s, 70, 0)
    m.SelectObject(wx.NullBitmap)
    b.SaveFile(filename, wx.BITMAP_TYPE_PNG) 
Example #30
Source File: MeshCanvas.py    From laplacian-meshes with GNU General Public License v3.0 5 votes vote down vote up
def saveImageGL(mvcanvas, filename):
    view = glGetIntegerv(GL_VIEWPORT)
    img = wx.EmptyImage(view[2], view[3] )
    pixels = glReadPixels(0, 0, view[2], view[3], GL_RGB,
                     GL_UNSIGNED_BYTE)
    img.SetData( pixels )
    img = img.Mirror(False)
    img.SaveFile(filename, wx.BITMAP_TYPE_PNG)