def app_path(): if hasattr(sys, "frozen"): from win32api import GetModuleFileName #We should only be here if using py2exe hence windows app_path = os.path.dirname(GetModuleFileName(0)) else: app_path = os.path.normpath(os.path.dirname(__file__)) return app_path
def _initPath(self): """Return the directory path of the dll @return str not unicode (c_char_p) @raise WindowsError, AttributeError """ from win32api import GetModuleFileName dllpath = GetModuleFileName(self.dll._handle) #dllpath = dllpath.encode('utf8', errors='ignore') return os.path.dirname(dllpath)
def root(file=None): if hasattr(sys, "frozen"): from win32api import GetModuleFileName path = os.path.dirname(GetModuleFileName(0)) else: path = os.path.split(os.path.realpath(__file__))[0] if file: path = os.path.join(path, file) return path
def _find_w9xpopen(self): """Find and return absolut path to w9xpopen.exe""" w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), "w9xpopen.exe") if not os.path.exists(w9xpopen): # Eeek - file-not-found - possibly an embedding # situation - see if we can locate it in sys.exec_prefix w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix), "w9xpopen.exe") if not os.path.exists(w9xpopen): raise RuntimeError("Cannot locate w9xpopen.exe, which is " "needed for Popen to work with your " "shell or platform.") return w9xpopen
def __init__(self): title = 'wxCommander' #style = wx.DEFAULT_FRAME_STYLE & ~ (wx.FRAME_NO_TASKBAR) & wx.STAY_ON_TOP & ~ (wx.RESIZE_BORDER) style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER) wx.Frame.__init__(self,parent=None, title=title, style=style, size = (1920,1080)) self.Maximize(True) #self.SetSize(1920, 1080) self.panelHijo = MyPanel(self) self.frame_number = 1 #self.Maximize(True) self.SizerPrincipal = wx.BoxSizer(wx.VERTICAL) self.SizerPrincipal.Add(self.panelHijo, 1, wx.EXPAND) self.Bind(wx.EVT_SIZE, self.OnResizeWindow) # Evento de foco #self.Bind(wx.EVT_SET_FOCUS, self.onFocus) #self.panelHijo.Bind(wx.EVT_LEFT_UP, self.OnLeftClick) #self.panelHijo.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) #self.panelHijo.Bind(wx.EVT_RIGHT_UP, self.OnRightClick) #self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick) self.SetSizer(self.SizerPrincipal) try: if os.path.isfile('icono.ico'): icono = wx.Icon("icono.ico") else: exeName = GetModuleFileName(GetModuleHandle(None)) icono = wx.Icon(exeName, wx.BITMAP_TYPE_ICO) self.SetIcon(icono) except: pass self.__barraMenus() self.CreateStatusBar() self.SetStatusText("Copyright TOI") #self.Fit() self.Show()
def run_script_at_startup_set(app_name, script): path = "%s %s" % (GetModuleFileName(0), script) run_at_startup_set(app_name, path)