Python wx.Icon() Examples

The following are 30 code examples of wx.Icon(). 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: daily.py    From Bruno with MIT License 6 votes vote down vote up
def __init__(self):
        wx.Frame.__init__(self, None,
                          pos=wx.DefaultPosition, size=wx.Size(450, 100),
                          style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |
                          wx.CLOSE_BOX | wx.CLIP_CHILDREN,
                          title="BRUNO")
        panel = wx.Panel(self)

        ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO)
        self.SetIcon(ico)

        my_sizer = wx.BoxSizer(wx.VERTICAL)
        lbl = wx.StaticText(panel,
                            label="Bienvenido Sir. How can I help you?")
        my_sizer.Add(lbl, 0, wx.ALL, 5)
        self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER,
                               size=(400, 30))
        self.txt.SetFocus()
        self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
        my_sizer.Add(self.txt, 0, wx.ALL, 5)
        panel.SetSizer(my_sizer)
        self.Show()
        speak.Speak('''Welcome back Sir, Broono at your service.''') 
Example #2
Source File: relay_modbus_gui.py    From R421A08-rs485-8ch-relay-board with MIT License 6 votes vote down vote up
def OnMenuAbout(self, event):
        """
            Display an About Dialog
        :param event:
        :return:
        """
        info = wx.adv.AboutDialogInfo()
        info.SetName('RS485 MODBUS GUI')
        info.SetVersion('v{}'.format(relay_modbus.VERSION))
        info.SetCopyright('(C) 2018 by Erriez')
        ico_path = resource_path('images/modbus.ico')
        if os.path.exists(ico_path):
            info.SetIcon(wx.Icon(ico_path))
        info.SetDescription(wordwrap(
            "This is an example application to monitor and send MODBUS commands using wxPython!",
            350, wx.ClientDC(self)))
        info.SetWebSite("https://github.com/Erriez/R421A08-rs485-8ch-relay-board",
                        "Source & Documentation")
        info.AddDeveloper('Erriez')
        info.SetLicense(wordwrap("MIT License: Completely and totally open source!", 500,
                                 wx.ClientDC(self)))
        # Then we call wx.AboutBox giving it that info object
        wx.adv.AboutBox(info) 
Example #3
Source File: relay_board_gui.py    From R421A08-rs485-8ch-relay-board with MIT License 6 votes vote down vote up
def OnAboutClick(self, event=None):
        info = wx.adv.AboutDialogInfo()
        info.SetName('RS485 MODBUS GUI')
        info.SetVersion('v{}'.format(relay_boards.VERSION))
        info.SetCopyright('(C) 2018 by Erriez')
        ico_path = resource_path('images/R421A08.ico')
        if os.path.exists(ico_path):
            info.SetIcon(wx.Icon(ico_path))
        info.SetDescription(wordwrap(
            "This is an example application to control a R421A08 relay board using wxPython!",
            350, wx.ClientDC(self)))
        info.SetWebSite(SOURCE_URL,
                        "Source & Documentation")
        info.AddDeveloper('Erriez')
        info.SetLicense(wordwrap("MIT License: Completely and totally open source!", 500,
                                 wx.ClientDC(self)))
        wx.adv.AboutBox(info)


# --------------------------------------------------------------------------------------------------
# Relay panel
# -------------------------------------------------------------------------------------------------- 
Example #4
Source File: Gui.py    From Crypter with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        '''
        @summary: Constructor
        @param config_dict: The build configuration, if present
        @param load_config: Handle to a config loader method/object
        '''
        self.language = DEFAULT_LANGUAGE
        self.__builder = None
        self.config_file_path = None
        
        # Init super - MainFrame
        MainFrame.__init__( self, parent=None )
        self.console = Console(self.ConsoleTextCtrl)
        self.StatusBar.SetStatusText("Ready...")
        icon = wx.Icon()
        icon.CopyFromBitmap(wx.Bitmap(os.path.join(self.__get_resources_path(), "builder_logo.bmp"), wx.BITMAP_TYPE_ANY))

        self.SetIcon(icon)
        
        # Update GUI Visuals
        self.update_gui_visuals()
        
        # Set initial event handlers
        self.set_events() 
Example #5
Source File: __init__.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def OnInit(self):
        self.running = True
        if profile:
            try:
                os.unlink(prof_file_name)
            except:
                pass
            self.prof = Profiler()
            self.prof.enable()
        
        wx.the_app = self
        self._DoIterationId = wx.NewEventType()
        self.Connect(-1, -1, self._DoIterationId, self._doIteration)
        self.evt = wx.PyEvent()
        self.evt.SetEventType(self._DoIterationId)
        self.event_queue = []

        # this breaks TreeListCtrl, and I'm too lazy to figure out why
        #wx.IdleEvent_SetMode(wx.IDLE_PROCESS_SPECIFIED)
        # this fixes 24bit-color toolbar buttons
        wx.SystemOptions_SetOptionInt("msw.remap", 0)
        icon_path = os.path.join(image_root, 'bittorrent.ico')
        self.icon = wx.Icon(icon_path, wx.BITMAP_TYPE_ICO)
        return True 
Example #6
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 #7
Source File: chronolapse.py    From chronolapse with MIT License 6 votes vote down vote up
def __init__(self, parent, MainFrame, workingdir):
        wx.TaskBarIcon.__init__(self)
        self.parentApp = parent
        self.MainFrame = MainFrame
        self.wx_id = wx.NewId()

        if ON_WINDOWS:
            icon_file = os.path.join(
                            os.path.abspath(workingdir),
                            'chronolapse.ico'
                        )
        else:
            icon_file = os.path.join(
                            os.path.abspath(workingdir),
                            'chronolapse_24.ico'
                        )
        self.SetIcon(wx.Icon(icon_file, wx.BITMAP_TYPE_ICO), 'Chronolapse')
        self.CreateMenu() 
Example #8
Source File: systray.py    From p2ptv-pi with MIT License 6 votes vote down vote up
def __init__(self, wxapp, bgapp, iconfilename):
        wx.TaskBarIcon.__init__(self)
        self.bgapp = bgapp
        self.wxapp = wxapp
        self.icons = wx.IconBundle()
        self.icon = wx.Icon(iconfilename, wx.BITMAP_TYPE_ICO)
        self.icons.AddIcon(self.icon)
        self.Bind(wx.EVT_TASKBAR_LEFT_UP, self.OnLeftClicked)
        if sys.platform != 'darwin':
            self.SetIcon(self.icon, self.bgapp.appname)
        else:
            menuBar = wx.MenuBar()
            filemenu = wx.Menu()
            item = filemenu.Append(-1, 'E&xit', 'Terminate the program')
            self.Bind(wx.EVT_MENU, self.OnExit, item)
            wx.App.SetMacExitMenuItemId(item.GetId()) 
Example #9
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 #10
Source File: backend_wx.py    From GraphicDesignPatternByPython with MIT License 6 votes vote down vote up
def _set_frame_icon(frame):
    # set frame icon
    bundle = wx.IconBundle()
    for image in ('matplotlib.png', 'matplotlib_large.png'):
        image = os.path.join(matplotlib.rcParams['datapath'], 'images', image)
        if not os.path.exists(image):
            continue
        icon = wx.Icon(_load_bitmap(image))
        if not icon.IsOk():
            return
        bundle.AddIcon(icon)
    frame.SetIcons(bundle) 
Example #11
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def __init__(self, parent):
        super(Mainapp, self).__init__(parent)

        self.inception_model_loaded = False  # Value to make checks, as the image prediction Model should loaded only once
        self.model_collection_inception = []  # An Array to hold the Loaded model for use for subsequent calls for image prediction
        self.magic_collection = []  # A collection to hold the containing UI objects and its children

        pub.subscribe(self.reportPrediction, "report101" ) # Subscribe the function to the call coming from the thread

        # Set the User interface properties
        self.Action()
        self.SetBackgroundColour("green")
        self.SetSize((1000,600))
        self.SetTitle("Inception Playground")

        icon =  wx.Icon("PROGRAM_INSTALL_FULLPATH\\playground.png")
        self.SetIcon(icon)

        self.Centre()
        self.Show() 
Example #12
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def __init__(self, parent):
        super(Mainapp, self).__init__(parent)

        self.densenet_model_loaded = False  # Value to make checks, as the image prediction Model should loaded only once
        self.model_collection_densenet = []  # An Array to hold the Loaded model for use for subsequent calls for image prediction
        self.magic_collection = []  # A collection to hold the containing UI objects and its children

        pub.subscribe(self.reportPrediction, "report101" ) # Subscribe the function to the call coming from the thread

        # Set the User interface properties
        self.Action()
        self.SetBackgroundColour("green")
        self.SetSize((1000,600))
        self.SetTitle("DenseNet Playground")

        icon =  wx.Icon("PROGRAM_INSTALL_FULLPATH\\playground.png")
        self.SetIcon(icon)

        self.Centre()
        self.Show() 
Example #13
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def __init__(self, parent):
        super(Mainapp, self).__init__(parent)

        self.squeezenet_model_loaded = False  # Value to make checks, as the image prediction Model should loaded only once
        self.model_collection_squeezenet = []  # An Array to hold the Loaded model for use for subsequent calls for image prediction
        self.magic_collection = []  # A collection to hold the containing UI objects and its children

        pub.subscribe(self.reportPrediction, "report101" ) # Subscribe the function to the call coming from the thread

        # Set the User interface properties
        self.Action()
        self.SetBackgroundColour("green")
        self.SetSize((1000,600))
        self.SetTitle("SqueezeNet Playground")

        icon =  wx.Icon("PROGRAM_INSTALL_FULLPATH\\playground.png")
        self.SetIcon(icon)

        self.Centre()
        self.Show() 
Example #14
Source File: MainUI.py    From Model-Playgrounds with MIT License 6 votes vote down vote up
def __init__(self, parent):
        super(Mainapp, self).__init__(parent)

        self.resnet_model_loaded = False  # Value to make checks, as the image prediction Model should loaded only once
        self.model_collection_resnet = []  # An Array to hold the Loaded model for use for subsequent calls for image prediction
        self.magic_collection = []  # A collection to hold the containing UI objects and its children

        pub.subscribe(self.reportPrediction, "report101" ) # Subscribe the function to the call coming from the thread

        # Set the User interface properties
        self.Action()
        self.SetBackgroundColour("green")
        self.SetSize((1000,600))
        self.SetTitle("RestNet Playground")

        icon =  wx.Icon("PROGRAM_INSTALL_FULLPATH\\playground.png")
        self.SetIcon(icon)

        self.Centre()
        self.Show() 
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: Icons.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def GetWxIcon(self):
        """
        Return a wx.Icon of the icon.
        """
        icon = wx.EmptyIcon()
        icon.CopyFromBitmap(PilToBitmap(self.pil))
        return icon 
Example #17
Source File: Utils.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def GetHwndIcon(hWnd):
    """
    Get a wx.Icon from a window through its hwnd window handle
    """
    hIcon = DWORD()
    res = SendMessageTimeout(
        hWnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, byref(hIcon)
    )

    if res == 0:
        hIcon.value = 0
    if hIcon.value < 10:
        hIcon.value = GetClassLong(hWnd, GCL_HICONSM)
        if hIcon.value == 0:
            res = SendMessageTimeout(
                hWnd,
                WM_GETICON,
                ICON_BIG,
                0,
                SMTO_ABORTIFHUNG,
                1000,
                byref(hIcon)
            )
            if res == 0:
                hIcon.value = 0
            if hIcon.value < 10:
                hIcon.value = GetClassLong(hWnd, GCL_HICON)
    if hIcon.value != 0:
        icon = wx.NullIcon
        value = hIcon.value
        # ugly fix for "OverflowError: long int too large to convert to int"
        if value & 0x80000000:
            value = -((value ^ 0xffffffff) + 1)
        icon.SetHandle(value)
        icon.SetSize((16, 16))
        return icon
    else:
        return None 
Example #18
Source File: backend_wx.py    From CogAlg with MIT License 5 votes vote down vote up
def _set_frame_icon(frame):
    # set frame icon
    bundle = wx.IconBundle()
    for image in ('matplotlib.png', 'matplotlib_large.png'):
        image = os.path.join(matplotlib.rcParams['datapath'], 'images', image)
        if not os.path.exists(image):
            continue
        icon = wx.Icon(_load_bitmap(image))
        if not icon.IsOk():
            return
        bundle.AddIcon(icon)
    frame.SetIcons(bundle) 
Example #19
Source File: backend_wx.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _set_frame_icon(frame):
    # set frame icon
    bundle = wx.IconBundle()
    for image in ('matplotlib.png', 'matplotlib_large.png'):
        image = os.path.join(matplotlib.rcParams['datapath'], 'images', image)
        if not os.path.exists(image):
            continue
        icon = wx.Icon(_load_bitmap(image))
        if not icon.IsOk():
            return
        bundle.AddIcon(icon)
    frame.SetIcons(bundle) 
Example #20
Source File: adm.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def GetId(self, name):
    if name == None:
      return -1
    id=self.list.get(name)
    if id:
      return id

    id=-1
    bmp=wh.GetBitmap(name)
    if bmp:
      if bmp.GetSize() != self.GetSize(0):
        dcs=wx.MemoryDC()
        w1,h1=bmp.GetSize()
        dcs.SelectObject(bmp)
        dc=wx.MemoryDC()
        w,h=self.GetSize(0)
        bmpneu=wx.EmptyBitmap(w,h)
        dc.SelectObject(bmpneu)
        if wx.Platform not in ("__WXMAC__"):
          b=self.GetBitmap(1)
          dc.DrawBitmap(b, 0, 0, True)
        dc.StretchBlit(0, 0, w, h, dcs, 0,0,w1,h1)
        dc.SelectObject(wx.NullBitmap)
        dcs.SelectObject(wx.NullBitmap)
        id=self.Add(bmpneu)
        logger.debug("Bitmap %s has wrong format. Need %s, is %s", name, self.GetSize(0), bmp.GetSize())
      else:
        id=self.Add(bmp)
    else:
      fn="%s.ico" % name
      if os.path.exists(fn):
        id=self.AddIcon(wx.Icon(fn))
    self.list[name]=id
    return id 
Example #21
Source File: gui.py    From atbswp with GNU General Public License v3.0 5 votes vote down vote up
def on_about(self, event):
        """About dialog."""
        info = wx.adv.AboutDialogInfo()
        info.Name = "atbswp"
        info.Version = "v0.1"
        info.Copyright = ("(C) 2019 Mairo Paul Rufus <akoudanilo@gmail.com>\n")
        info.Description = "Record mouse and keyboard actions and reproduce them identically at will"
        info.WebSite = ("https://github.com/atbswp", "Project homepage")
        info.Developers = ["Mairo Paul Rufus"]
        info.License = "GNU General Public License V3"
        info.Icon = self.icon
        wx.adv.AboutBox(info) 
Example #22
Source File: control.py    From atbswp with GNU General Public License v3.0 5 votes vote down vote up
def action(self, event):
        """Triggered when the recording button is clicked on the GUI."""
        listener_mouse = mouse.Listener(
            on_move=self.on_move,
            on_click=self.on_click,
            on_scroll=self.on_scroll)
        listener_keyboard = keyboard.Listener(
            on_press=self.on_press,
            on_release=self.on_release)

        if event.GetEventObject().GetValue():
            listener_keyboard.start()
            listener_mouse.start()
            self.last_time = time.perf_counter()
            self.recording = True
            recording_state = wx.Icon(os.path.join(self.path, "img", "icon-recording.png"))
        else:
            self.recording = False
            with open(TMP_PATH, 'w') as f:
                # Remove the recording trigger event
                self._capture.pop()
                # If it's the mouse remove the previous also
                if "mouseDown" in self._capture[-1]:
                    self._capture.pop()
                f.seek(0)
                f.write("\n".join(self._capture))
                f.truncate()
            self._capture = [self._header]
            recording_state = wx.Icon(os.path.join(self.path, "img", "icon.png"))
        event.GetEventObject().GetParent().taskbar.SetIcon(recording_state) 
Example #23
Source File: main.py    From nuxhash with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, *args, **kwargs):
        wx.Frame.__init__(self, parent, *args, **kwargs)
        self.SetIcon(wx.Icon(wx.IconLocation(str(ICON_PATH))))
        self.SetSizeHints(minW=500, minH=500)
        self._Devices = self._ProbeDevices()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(EVT_PUBSUB, self.OnPubSend)

        # Create notebook and its pages.
        notebook = wx.Notebook(self)
        notebook.AddPage(
                MiningScreen(notebook, devices=self._Devices),
                text='Mining')
        notebook.AddPage(
                BenchmarksScreen(notebook, devices=self._Devices),
                text='Benchmarks')
        notebook.AddPage(
                SettingsScreen(notebook),
                text='Settings')
        notebook.AddPage(
                AboutScreen(notebook),
                text='About')

        # Check miner downloads.
        pub.subscribe(self._OnDownloadProgress, 'download.progress')
        self._DlThread = self._DlProgress = None
        self._DownloadMiners()

        # Read user data.
        pub.subscribe(self._OnSettings, 'data.settings')
        pub.subscribe(self._OnBenchmarks, 'data.benchmarks')

        loaded_settings = nuxhash.settings.load_settings(CONFIG_DIR)
        if loaded_settings == nuxhash.settings.DEFAULT_SETTINGS:
            self._FirstRun()
        pub.sendMessage('data.settings', settings=loaded_settings)

        benchmarks = nuxhash.settings.load_benchmarks(CONFIG_DIR, self._Devices)
        pub.sendMessage('data.benchmarks', benchmarks=benchmarks) 
Example #24
Source File: PLCOpenEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, fileOpen=None):
        """ Constructor of the PLCOpenEditor class.

        :param parent: The parent window.
        :param fileOpen: The filepath to open if no controler defined (default: None).
        """
        self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO)
        IDEFrame.__init__(self, parent)

        result = None

        # Open the filepath if defined
        if fileOpen is not None:
            fileOpen = DecodeFileSystemPath(fileOpen, False)
            if os.path.isfile(fileOpen):
                # Create a new controller
                controler = PLCControler()
                result = controler.OpenXMLFile(fileOpen)
                self.Controler = controler
                self.LibraryPanel.SetController(controler)
                self.ProjectTree.Enable(True)
                self.PouInstanceVariablesPanel.SetController(controler)
                self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)

        # Define PLCOpenEditor icon
        self.SetIcon(self.icon)

        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)

        self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)

        if result is not None:
            (num, line) = result
            self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line)) 
Example #25
Source File: launch_script.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):
        displays = (
            wx.Display(i) for i in range(wx.Display.GetCount())
        )  # Gets the number of displays
        screenSizes = [
            display.GetGeometry().GetSize() for display in displays
        ]  # Gets the size of each display
        index = 0  # For display 1.
        screenWidth = screenSizes[index][0]
        screenHeight = screenSizes[index][1]
        self.gui_size = (screenWidth * 0.7, screenHeight * 0.55)
        wx.Frame.__init__(
            self,
            None,
            wx.ID_ANY,
            "DeepLabCut",
            size=wx.Size(self.gui_size),
            pos=wx.DefaultPosition,
            style=wx.RESIZE_BORDER | wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL,
        )

        dlcparent_path = auxiliaryfunctions.get_deeplabcut_path()
        media_path = os.path.join(dlcparent_path, "gui", "media")
        logo = os.path.join(media_path, "logo.png")
        self.SetIcon(wx.Icon(logo))
        self.SetSizeHints(
            wx.Size(self.gui_size)
        )  #  This sets the minimum size of the GUI. It can scale now!
        # Here we create a panel and a notebook on the panel
        self.panel = wx.Panel(self)
        self.nb = wx.Notebook(self.panel)
        # create the page windows as children of the notebook and add the pages to the notebook with the label to show on the tab
        page1 = Welcome(self.nb, self.gui_size)
        self.nb.AddPage(page1, "Welcome")

        page2 = Create_new_project(self.nb, self.gui_size)
        self.nb.AddPage(page2, "Manage Project")

        self.sizer = wx.BoxSizer()
        self.sizer.Add(self.nb, 1, wx.EXPAND)
        self.panel.SetSizer(self.sizer) 
Example #26
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent, nodelist = None, projectOpen = None):
        if nodelist is None:
            NetworkEditorTemplate.__init__(self, NodeList(NodeManager()), self, True)
        else:
            NetworkEditorTemplate.__init__(self, nodelist, self, False)
        self._init_ctrls(parent)
        self.HtmlFrameOpened = []
        
        icon = wx.Icon(os.path.join(ScriptDirectory,"networkedit.ico"),wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)
                 
        if self.ModeSolo:
            if projectOpen:
                result = self.NodeList.LoadProject(projectOpen)
                if not result:
                    self.NodeList.SetCurrentSelected(0)
                    self.RefreshNetworkNodes()
                    self.RefreshProfileMenu()
            else:
                self.NodeList = None
        else:
            self.NodeList.SetCurrentSelected(0)
            self.RefreshNetworkNodes()
            self.RefreshProfileMenu()
        self.NetworkNodes.SetFocus()
        
        self.RefreshBufferState()
        self.RefreshTitle()
        self.RefreshMainMenu() 
Example #27
Source File: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent, manager = None, filesOpen = []):
        if manager is None:
            NodeEditorTemplate.__init__(self, NodeManager(), self, True)
        else:
            NodeEditorTemplate.__init__(self, manager, self, False)
        self._init_ctrls(parent)
        self.HtmlFrameOpened = []
        
        icon = wx.Icon(os.path.join(ScriptDirectory,"networkedit.ico"),wx.BITMAP_TYPE_ICO)
        self.SetIcon(icon)
        
        if self.ModeSolo:
            for filepath in filesOpen:
                result = self.Manager.OpenFileInCurrent(os.path.abspath(filepath))
                if isinstance(result, (IntType, LongType)):
                    new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
                    new_editingpanel.SetIndex(result)
                    self.FileOpened.AddPage(new_editingpanel, "")
        else:
            for index in self.Manager.GetBufferIndexes():
                new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
                new_editingpanel.SetIndex(index)
                self.FileOpened.AddPage(new_editingpanel, "")
        
        if self.Manager.GetBufferNumber() > 0:
            window = self.FileOpened.GetPage(0)
            if window:
                self.Manager.ChangeCurrentNode(window.GetIndex())
                self.FileOpened.SetSelection(0)
        
        if self.Manager.CurrentDS302Defined():
            self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True)
        else:
            self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False)
        self.RefreshEditMenu()
        self.RefreshBufferState()
        self.RefreshProfileMenu()
        self.RefreshTitle()
        self.RefreshMainMenu() 
Example #28
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 #29
Source File: test_sms.py    From openplotter with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):

			self.option=sys.argv[1]
			self.text_sms=sys.argv[2]
			self.text_sms=unicode(self.text_sms,'utf-8')
			self.phone=sys.argv[3]

			self.conf = Conf()
			self.home = self.conf.home
			self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter'

			Language(self.conf)

			wx.Frame.__init__(self, None, title=_('Test SMS'), size=(500,260))

			self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
			
			self.icon = wx.Icon(self.currentpath+'/openplotter.ico', wx.BITMAP_TYPE_ICO)
			self.SetIcon(self.icon)

			self.CreateStatusBar()

			self.text=wx.StaticText(self, label=_('Error'), pos=(10, 10))

			self.output = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_DONTWRAP, size=(480,110), pos=(10,50))
			
			self.button_close =wx.Button(self, label=_('Close'), pos=(300, 170))
			self.Bind(wx.EVT_BUTTON, self.close, self.button_close)

			self.button_calculate =wx.Button(self, label=_('Start'), pos=(400, 170))
			self.Bind(wx.EVT_BUTTON, self.calculate, self.button_calculate)

			if self.option=='i': 
				self.text.SetLabel(_('Press start to check the settings and connect to the GSM device'))

			if self.option=='t':
				self.text.SetLabel(_('Press start to send the text "').decode('utf8')+self.text_sms+_('"\nto the number "').decode('utf8')+self.phone+'"')

			self.Centre() 
Example #30
Source File: wxpython_toggle.py    From R421A08-rs485-8ch-relay-board with MIT License 5 votes vote down vote up
def CreateWindow(self, parent):
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetMinSize(wx.Size(250, 250))
        self.SetBackgroundColour(wx.Colour(240, 240, 240))
        if os.path.exists(ICO_PATH):
            self.SetIcon(wx.Icon(ICO_PATH))

        self.CreateMenuBar()
        self.CreateRelayButtons()
        self.CreateStatusbar()

        self.Layout()
        self.Centre(wx.BOTH)