def main(opts):
app = wx.App(False)
window = GUI(None, id=1, title="stopgo", style=wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE, clargs=opts)
window.Show()
app.MainLoop()
return True
python类App()的实例源码
def __init__(self, renderer, title="wx test"):
"Creates an OpenGL context and a window, and acquires OpenGL resources"
self.renderer = renderer
self.title = title
self._is_initialized = False # keep track of whether self.init_gl() has been called
self.window = None
wx.App.__init__(self, redirect = False)
def __init__(self, show_new_ui=False, redirect=False, filename=None):
wx.App.__init__(self, redirect, filename)
self.get_app_info()
self.check_for_update()
user_config_file = path.join(user_config_dir("iridaUploader"), "config.conf")
if not path.exists(user_config_file):
dialog = SettingsDialog(first_run=True)
dialog.ShowModal()
self._show_main_app()
def main():
import config
app = wx.App()
for screen in config.GRID:
x1, y1, x2, y2 = screen
w = x2 - x1
h = y2 - y1
# print screen, w, h
frm = AppFrame(size=(w, h), pos=(x1, y1))
frm.ShowWithoutActivating()
app.MainLoop()
def main():
wx.Log.SetLogLevel(0)
app = wx.App()
app.frame = WindowClass(None)
app.MainLoop()
def __init__(self, *args, **kwargs):
wx.App.__init__(self, *args, **kwargs)
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,"Test App")
self.renderer = Renderer(self)
self.log = MyTextCtrl(self)
self.Canvas = MyCanvas(self)
sizer = wx.BoxSizer()
sizer.Add(self.Canvas,3,wx.EXPAND)
sizer.Add(self.log,1,wx.EXPAND)
self.SetSizer(sizer)
self.Bind(wx.EVT_CLOSE,self.OnExit)
self.Show(True)
def __init__(self):
'''
@summary: Constructor
'''
# Initialise the Builder GUI
app = wx.App()
builder_gui = Gui()
builder_gui.Show()
app.MainLoop()
def main():
def onKeyDown(event):
if event.GetKeyCode() == wx.WXK_ESCAPE:
frame.Close()
app = wx.App(0)
frame = wx.Frame(None, title="Hello World from wxPython")
panel = wx.Panel(frame)
label = wx.StaticText(panel, -1,
u"Press <ESC> to exit. Some non-ascii chars: ??š?íá?")
panel.Bind(wx.EVT_KEY_DOWN, onKeyDown)
panel.SetFocus()
frame.Show()
app.MainLoop()
def __init__(self, title=None, masterPID=-1, launch_listen_thread=False, control_panels_to_load=None,
default_data_dir=None, default_autoload_pattern=None):
self.__version__ = version=about["__version__"]
WatchMasterPIDThread(masterPID)
app = wx.App(False)
self.frame = ZTVFrame(title=title, launch_listen_thread=launch_listen_thread,
control_panels_to_load=control_panels_to_load,
default_data_dir=default_data_dir,
default_autoload_pattern=default_autoload_pattern)
app.MainLoop()
# TODO: need to figure out why ztvframe_pid is being left alive
def __init__(self, title=None, masterPID=-1, launch_listen_thread=False, control_panels_to_load=None,
default_data_dir=None, default_autoload_pattern=None):
self.__version__ = version=about["__version__"]
WatchMasterPIDThread(masterPID)
app = wx.App(False)
self.frame = ZTVFrame(title=title, launch_listen_thread=launch_listen_thread,
control_panels_to_load=control_panels_to_load,
default_data_dir=default_data_dir,
default_autoload_pattern=default_autoload_pattern)
app.MainLoop()
# TODO: need to figure out why ztvframe_pid is being left alive
def main():
app = wx.App()
Make_TL(None)
app.MainLoop()
def main():
app = wx.App()
config_cam(None)
app.MainLoop()
def main():
app = wx.App()
window = MainApp(None)
window.Show(True)
app.MainLoop()
def __test():
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame = TestFrame(None, -1, "PlotCanvas")
# frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(0)
app.MainLoop()
def explore_cellstar(cellstar=None, seeds=[], snakes=[], images=None, image=None, params=None):
if explorer_expected():
value = 0
try:
app = None
try:
import wx
app = wx.App(0)
except:
pass
import utils.explorer as exp
if image is None:
image = cellstar.images.image
if images is None:
images = cellstar.images
explorer_ui = exp.ExplorerFrame(images)
explorer = exp.Explorer(image, images, explorer_ui, cellstar, params)
explorer.stick_seeds = seeds
explorer.stick_snakes = snakes
value = explorer_ui.ShowModal()
#if app is not None:
# app.MainLoop()
except Exception as ex:
print ex
pass
if value == exp.ExplorerFrame.ABORTED:
raise Exception("Execution aborted")
def enable_wx(self, app=None):
"""Enable event loop integration with wxPython.
Parameters
----------
app : WX Application, optional.
Running application to use. If not given, we probe WX for an
existing application object, and create a new one if none is found.
Notes
-----
This methods sets the ``PyOS_InputHook`` for wxPython, which allows
the wxPython to integrate with terminal based applications like
IPython.
If ``app`` is not given we probe for an existing one, and return it if
found. If no existing app is found, we create an :class:`wx.App` as
follows::
import wx
app = wx.App(redirect=False, clearSigInt=False)
"""
import wx
from distutils.version import LooseVersion as V
wx_version = V(wx.__version__).version # @UndefinedVariable
if wx_version < [2, 8]:
raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__) # @UndefinedVariable
from pydev_ipython.inputhookwx import inputhook_wx
self.set_inputhook(inputhook_wx)
self._current_gui = GUI_WX
if app is None:
app = wx.GetApp() # @UndefinedVariable
if app is None:
app = wx.App(redirect=False, clearSigInt=False) # @UndefinedVariable
app._in_event_loop = True
self._apps[GUI_WX] = app
return app
def OnInit(self):
frame = MyFrame(None, "Simple wxPython App")
self.SetTopWindow(frame)
print("Print statements go to this stdout window by default.")
frame.Show(True)
return True
def __init__(self, redirect=False):
'''
Takes a location as a tuple of the form (LAT, LON)
'''
# App fields
wx.App.__init__(self, redirect)
self.frame = wx.Frame(None, title='Pinder')
self.panel = wx.Panel(self.frame)
self.PhotoMaxSize = 240
self.createWidgets()
self.frame.Show()
# Authenticate Facebook token
self.login()
# Start pynder session
self.start_session()
# Geopy fields
self.location = 'Somewhere'
self.latlon = None
# Ask for initial location
self.onChangeLoc(None)
self.users = []
self.users_index = 0
self.hopeful = None
self.update_user()
def __init__(self):
screenSize = wx.DisplaySize()
x = screenSize[0]
y = screenSize[1]-80
wx.Frame.__init__(self, None, title="App Auto Viewer",
size=(x-80,y))
self.panel = MainPanel(self)
self.statusB = self.CreateStatusBar(number=2)
global recordStatus
recordStatus = "?"
self.updateRecordStatus(recordStatus)
self.statusB.SetStatusText("??? ???", 1)