Exemplo n.º 1
0
    def OnAbout(self,e):
        # Create a message dialog box
        dlg = wx.MessageDialog(self, " Graphical toolkit for PhyloIsland profiles" , "About PhyloIsland Graphical Toolkit", wx.OK)
        dlg.ShowModal() # Shows it
        dlg.Destroy() # finally destroy it when finished.

    def OnExit(self,e):
        self.Close(True)  # Close the frame.

    def OnOpen(self,e):
        """ Open a file"""
        dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.*", wx.FD_OPEN)
        if dlg.ShowModal() == wx.ID_OK:
            self.filename = dlg.GetFilename()
            self.dirname = dlg.GetDirectory()
            f = open(os.path.join(self.dirname, self.filename), 'r')
            self.control.SetValue(f.read())
            f.close()
        dlg.Destroy()
        
app22 = wx.App(False)
frame = PhyloIslandWindow(None, "PhyloIsland Graphical Interface")
nb = wx.Notebook(frame)

nb.AddPage(Panel1(nb),"Panel 1")
frame.Show()
app22.MainLoop()
        
        
        
Exemplo n.º 2
0
def main():
    import wx
    import PYME.resources
    from PYME import config
    from optparse import OptionParser
    from PYME.IO.FileUtils import nameUtils

    op = OptionParser(usage='usage: %s [options]' % sys.argv[0])
    default_root = config.get('dataserver-root')
    op.add_option(
        '-r',
        '--root',
        dest='root',
        help=
        "Root directory of virtual filesystem (default %s, see also 'dataserver-root' config entry)"
        % default_root,
        default=default_root)
    op.add_option('--ui', dest='ui', help='launch web based ui', default=True)
    op.add_option('--clusterUI',
                  dest='clusterui',
                  help='launch the full django-based cluster UI',
                  action='store_true',
                  default=False)

    options, args = op.parse_args()

    if wx.__version__ > '4':
        from wx.adv import TaskBarIcon, TBI_DOCK
    else:
        from wx import TaskBarIcon, TBI_DOCK

    cluster = ClusterOfOne(root_dir=options.root)

    app = wx.App()

    ico = wx.Icon(PYME.resources.getIconPath('pymeLogo.png'))

    class ClusterIcon(TaskBarIcon):
        TBMENU_CLUSTERUI = wx.NewId()
        TBMENU_CLOSE = wx.NewId()

        def __init__(self, frame):
            TaskBarIcon.__init__(self, TBI_DOCK)
            self.frame = frame

            print('Setting icon')
            self.SetIcon(ico, 'PYMECluster')

        def CreatePopupMenu(self, evt=None):
            """
            This method is called by the base class when it needs to popup
            the menu for the default EVT_RIGHT_DOWN event.  Just create
            the menu how you want it and return it from this function,
            the base class takes care of the rest.
            """
            menu = wx.Menu()
            menu.Append(self.TBMENU_CLUSTERUI, 'ClusterUI')

            return menu

    frame = wx.Frame(None)
    frame.SetIcon(ico)

    tb_icon = ClusterIcon(frame)

    #frame.Show()

    try:
        cluster.launch(gui=options.ui, clusterUI=options.clusterui)
        app.MainLoop()
    finally:
        cluster.shutdown()
Exemplo n.º 3
0
        event.Skip()

    def OnEraseBackground(self, evt):
        pass


if __name__ == "__main__":

    class DemoFrame(wx.Frame):
        def __init__(self, title="Micro App"):
            wx.Frame.__init__(self, None, -1, title)

            btn = wx.Button(self, -1, "Do Stuff")
            btn.Bind(wx.EVT_BUTTON, self.on_stuff)

            panel = TestPanel(self, -1)

            sizer = wx.BoxSizer(wx.VERTICAL)
            sizer.Add(btn, 0, wx.ALIGN_CENTER | wx.ALL, 5)
            sizer.Add(panel, 1, wx.GROW)

            self.SetSizer(sizer)

        def on_stuff(self, evt):
            print("Stuff!")

    app = wx.App(False)
    frame = DemoFrame()
    frame.Show()
    app.MainLoop()
Exemplo n.º 4
0
        hbox.Add(tbox)
        hbox.Add((10, 10), 1)

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add((10, 10), 1)
        box.Add(hbox, 0, wx.EXPAND)
        box.Add((10, 10), 2)

        self.SetSizer(box)
        self.Fit()


#----------------------------------------------------------------------

if __name__ == '__main__':
    app = wx.App(redirect=False)
    frm = wx.Frame(None, title='MessagePanel Test')
    pnl = MessagePanel(frm,
                       flags=wx.ICON_EXCLAMATION,
                       caption="Please stand by...",
                       message="""\
This is a test.  This is a test of the emergency broadcast
system.  Had this been a real emergency, you would have
already been reduced to a pile of radioactive cinders and
wondering why 'duck and cover' didn't help.

This is only a test...""")
    frm.Sizer = wx.BoxSizer()
    frm.Sizer.Add(pnl, 1, wx.EXPAND)
    frm.Fit()
    frm.Show()
Exemplo n.º 5
0
 def setUp(self):
     self.app = wx.App(False)
def show(config):
    app = wx.App()
    frame = MainFrame(None,config).Show()
    app.MainLoop()
Exemplo n.º 7
0
def ensureMinimal(minVersion, optionsRequired=False):
    """
    Checks to see if the default version of wxPython is greater-than
    or equal to `minVersion`.  If not then it will try to find an
    installed version that is >= minVersion.  If none are available
    then a message is displayed that will inform the user and will
    offer to open their web browser to the wxPython downloads page,
    and will then exit the application.
    """
    assert type(minVersion) == str

    # ensure that wxPython hasn't been imported yet.
    if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
        raise AlreadyImportedError("wxversion.ensureMinimal() must be called before wxPython is imported")

    bestMatch = None
    minv = _wxPackageInfo(minVersion)

    # check the default version first
    defaultPath = _find_default()
    if defaultPath:
        defv = _wxPackageInfo(defaultPath, True)
        if defv >= minv and minv.CheckOptions(defv, optionsRequired):
            bestMatch = defv

    # if still no match then check look at all installed versions
    if bestMatch is None:
        installed = _find_installed()
        # The list is in reverse sorted order, so find the first
        # one that is big enough and optionally matches the
        # options
        for inst in installed:
            if inst >= minv and minv.CheckOptions(inst, optionsRequired):
                bestMatch = inst
                break

    # if still no match then prompt the user
    if bestMatch is None:
        if _EM_DEBUG: # We'll do it this way just for the test code below
            raise VersionError("Requested version of wxPython not found")
        
        import wx, webbrowser
        versions = "\n".join(["      "+ver for ver in getInstalled()])
        app = wx.App()
        result = wx.MessageBox("This application requires a version of wxPython "
                               "greater than or equal to %s, but a matching version "
                               "was not found.\n\n"
                               "You currently have these version(s) installed:\n%s\n\n"
                               "Would you like to download a new version of wxPython?\n"
                               % (minVersion, versions),
                      "wxPython Upgrade Needed", style=wx.YES_NO)
        if result == wx.YES:
            webbrowser.open(UPDATE_URL)
        app.MainLoop()
        sys.exit()

    sys.path.insert(0, bestMatch.pathname)
    # q.v. Bug #1409256
    path64 = re.sub('/lib/','/lib64/',bestMatch.pathname)
    if os.path.isdir(path64):
        sys.path.insert(0, path64)
    global _selected
    _selected = bestMatch
Exemplo n.º 8
0
def dispGUI():
    ex = wx.App(False)
    windows = MainFrame(None, 'CANSim')
    ex.MainLoop()
Exemplo n.º 9
0
def test_gui():
    app = wx.App()
    frame = Frame1(None, 'example')
    app.MainLoop()
        sizer1 = wx.StaticBoxSizer(box=box1, orient=wx.VERTICAL)  # 创建StaticBoxSizer对象
        for item in ["aaa", "bbb", "ccc"]:
            btn = wx.Button(box1, -1, item)
            sizer1.Add(btn)

        box2 = wx.StaticBox(panel, -1, "Number")  # 使用StaticBoxSizer之前通常使用StaticBox
        sizer2 = wx.StaticBoxSizer(box=box2, orient=wx.VERTICAL)
        for item in ["111", "222", "333"]:
            btn = wx.Button(box2, -1, item)
            sizer2.Add(btn)

        sizer.Add(sizer1)  # sizer的嵌套,添加的是布局管理器
        sizer.Add(sizer2)  # 实现的效果:sizer1和sizer2的内部是StaticBox布局,但它们之间是Box布局
        panel.SetSizer(sizer)  # 将sizer关联到容器


if __name__ == '__main__':
    root = wx.App()
    frame = TextFrame()
    frame.SetMaxSize((600, 600))  # 最大缩放尺寸
    frame.SetMinSize((300, 300))  # 最小缩放尺寸
    frame.Show()
    root.MainLoop()

# ### 静态框(StaticBox类)
# https://docs.wxpython.org/wx.StaticBox.html
#
# ### wx.StaticBoxSizer
# https://docs.wxpython.org/wx.StaticBoxSizer.html
# 可以使用静态框在sizer周围提供一个边框和文本标签;
Exemplo n.º 11
0
Run this script to start the application.

Provides
--------

* Commandlineparser: Gets command line options and parameters
* MainApplication: Initial command line operations and application launch

"""

import sys
import optparse

import wx
__ = wx.App(False)  # Windows Hack

from sysvars import get_program_path
import lib.i18n as i18n

# Use ugettext instead of getttext to avoid unicode errors
_ = i18n.language.ugettext

sys.setrecursionlimit(65535)
sys.path.insert(0, get_program_path())

# Separate icon in the Windows dock for Ms Windows
try:
    import ctypes
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pyspread')
except AttributeError:
Exemplo n.º 12
0
# EMTG: Evolutionary Mission Trajectory Generator
# An open-source global optimization tool for preliminary mission design
# Provided by NASA Goddard Space Flight Center
#
# Copyright (c) 2013 - 2020 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Other Rights Reserved.
#
# Licensed under the NASA Open Source License (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# https://opensource.org/licenses/NASA-1.3
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.   See the License for the specific language
# governing permissions and limitations under the License.

#import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('wxagg')
import wx

import PyEMTG_interface
import numpy as np
import MissionOptions as MO

if __name__ == '__main__':
    application = wx.App(redirect=False)
    PyEMTG_interface.PyEMTG_interface(None)
    application.MainLoop()
Exemplo n.º 13
0
def main():
    app = wx.App()
    Example(None)
    app.MainLoop()
Exemplo n.º 14
0
    def __init__(self, *args, **kwargs):

        self.__wx_app = wx.App(redirect=False)
        self.run = None
        self.view = None
        self.init(*args, **kwargs)
def main():
    gui = wx.App(False)
    main_window.MainWindow(None, 'Crestron Cleanup')
    gui.MainLoop()
Exemplo n.º 16
0
# Distributed under the terms of the GNU General Public License (GPL).

# Author: Jeremy Gray, Oct 2012; localization 2014

from pyglet.gl import gl_info
import os
import sys
import wx
import numpy as np
import platform
import codecs

if wx.version() < '2.9':
    tmpApp = wx.PySimpleApp()
else:
    tmpApp = wx.App(False)
from psychopy.app.localization import _translate
from psychopy import (info, data, visual, gui, core, __version__,
                      prefs, event)

# set values, using a form that poedit can discover:
_localized = {
    'Benchmark': _translate('Benchmark'),
    'benchmark version': _translate('benchmark version'),
    'full-screen': _translate('full-screen'),
    'dots_circle': _translate('dots_circle'),
    'dots_square': _translate('dots_square'),
    'available memory': _translate('available memory'),
    'python version': _translate('python version'),
    'locale': _translate('locale'),
    'Visual': _translate('Visual'),
Exemplo n.º 17
0
 def run_app(results):
     app = wx.App(0)
     frame = RingerFrame(None, -1, "Ringer results")
     frame.show_results(results)
     frame.Show()
     app.MainLoop()
Exemplo n.º 18
0
 def setUp(self):
     self._wxapp = wx.App()
     self.mainWindow = None
def main1():
    app = wx.App()
    frame = Function(None, -1)
    frame.Centre()
    frame.Show()
    app.MainLoop()
Exemplo n.º 20
0
    (165, 0, 33),
]

if __name__ == "__main__":
    import wx
    # tiny test app
    AllSchemes = [("CategoricalColor1", CategoricalColor1),
                  ("RedToBlue11", RedToBlue11),
                  ("BlueToDarkRed12", BlueToDarkRed12),
                  ("BlueToDarkRed10", BlueToDarkRed10),
                  ("BlueToDarkRed8", BlueToDarkRed8)]

    class TestFrame(wx.Frame):
        def __init__(self, *args, **kwargs):
            wx.Frame.__init__(self, *args, **kwargs)
            Hsizer = wx.BoxSizer(wx.HORIZONTAL)
            for scheme in AllSchemes:
                Sizer = wx.BoxSizer(wx.VERTICAL)
                Sizer.Add(wx.StaticText(self, label=scheme[0]), 0, wx.ALL, 5)
                for c in scheme[1]:
                    w = wx.Window(self, size=(100, 20))
                    w.SetBackgroundColour(wx.Colour(*c))
                    Sizer.Add(w, 0, wx.ALL, 5)
                Hsizer.Add(Sizer, 0, wx.ALL, 5)
            self.SetSizerAndFit(Hsizer)
            self.Show()

    A = wx.App(False)
    F = TestFrame(None)
    A.MainLoop()
Exemplo n.º 21
0
def main():
    app = wx.App(False)
    frame = SnifferGUI(None, 'Create Fake AP')
    app.MainLoop()
Exemplo n.º 22
0
def main():

    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
Exemplo n.º 23
0
            panel, label="Hello I am your Assistant. Ask me something.")
        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()

    def OnEnter(self, event):

        input = self.txt.GetValue()
        input = input.lower()
        try:

            res = client.query(input)
            answer = next(res.results).text
            print(answer)
        except:
            #input = input.split(' ')
            #input = " ".join(input[2:])
            print(wikipedia.summary(input))


if __name__ == "__main__":
    app = wx.App(True)
    frame = MyFrame()
    app.MainLoop()
Exemplo n.º 24
0
if debug==1:
	print args.lang,args.n,args.nbrep,args.filename

sujet = args.subject[0] ##int(args.subject[0])-1 ##args.subject[0]
expenum = args.expe[0] ##int(args.n[0])-1
#sampacol = int(args.sampa[0])-1
#nbrep = int(args.nbrep[0])
#infile = args.filename[0]
#language = args.lang[0]
#csvsep = args.csvsep[0]

#STIMDUR = int(args.STIMDUR[0])
#ITI = int(args.ISI[0])

import wx
tmp = wx.App(False)
screen_size = wx.GetDisplaySize()

trainingsize=12

import Caterpyllar as pyllar

import sys
import locale
import re
import string
import pygame
from pygame.locals import * # events, key names (MOUSEBUTTONDOWN,K_r...)
import time
import scipy
import random
Exemplo n.º 25
0
        self.Asp.SetValue(False)
        self.Glu.SetValue(False)
        self.Asn.SetValue(False)
        self.Gln.SetValue(False)
        self.Ser.SetValue(False)
        self.Thr.SetValue(False)
        self.Arg.SetValue(False)
        self.His.SetValue(False)
        self.Lys.SetValue(False)
        self.Cys.SetValue(False)
        self.Gly.SetValue(False)
        self.Pro.SetValue(False)
        self.mixed_base_codon.SetReadOnly(False)
        self.mixed_base_codon.SetText('None')
        self.mixed_base_codon.SetReadOnly(True)
        self.target_hits.SetLabel('Target amino acids: ')
        self.offtarget_hits.SetLabel('Off-target amino acids: ')
        self.OnToggle("")


if __name__ == '__main__':  #if script is run by itself and not loaded
    app = wx.App(
    )  # creation of the wx.App object (initialisation of the wxpython toolkit)
    frame = wx.Frame(None, title="Mixed Base Codons",
                     size=(420, 500))  # creation of a Frame with a title
    frame.MBC = MixedBaseCodon(
        frame)  # creation of a richtextctrl in the frame
    frame.Show(
    )  # frames are invisible by default so we use Show() to make them visible
    app.MainLoop()  # here the app enters a loop waiting for user input
Exemplo n.º 26
0
def enter_city_map(cityname, city_name_pinyin, lng, lat):
    app = wx.App()
    frame0 = Frame_control(cityname, city_name_pinyin, lng, lat)
    frame0.Center()
    frame0.Show()
    app.MainLoop()
Exemplo n.º 27
0
            part.SetColour(wx.Colour(50, 50, 200))
            mypie._series.append(part)

            # create a ProgressPie
            progress_pie = ProgressPie(panel, 100, 50, -1, wx.DefaultPosition,
                                       wx.Size(180, 200), wx.SIMPLE_BORDER)

            progress_pie.SetBackColour(wx.Colour(150, 200, 255))
            progress_pie.SetFilledColour(wx.Colour(255, 0, 0))
            progress_pie.SetUnfilledColour(wx.WHITE)
            progress_pie.SetHeight(20)

            main_sizer = wx.BoxSizer(wx.HORIZONTAL)

            main_sizer.Add(mypie, 1, wx.EXPAND | wx.ALL, 5)
            main_sizer.Add(progress_pie, 1, wx.EXPAND | wx.ALL, 5)

            panel.SetSizer(main_sizer)
            main_sizer.Layout()


    # our normal wxApp-derived class, as usual

    app = wx.App(0)

    frame = MyFrame(None)
    app.SetTopWindow(frame)
    frame.Show()

    app.MainLoop()
Exemplo n.º 28
0
def main():
    options, flags = gscript.parser()

    import wx

    from grass.script.setup import set_gui_path
    set_gui_path()

    from core.utils import _
    from core.giface import StandaloneGrassInterface
    try:
        from tplot.frame import TplotFrame
    except ImportError as e:
        gscript.fatal(e.message)
    rasters = None
    if options['strds']:
        rasters = options['strds'].strip().split(',')
    coords = None
    if options['coordinates']:
        coords = options['coordinates'].strip().split(',')
    cats = None
    if options['cats']:
        cats = options['cats']
    output = options['output']
    vectors = None
    attr = None
    if options['stvds']:
        vectors = options['stvds'].strip().split(',')
        if not options['attr']:
            gscript.fatal(_("With stvds you have to set 'attr' option"))
        else:
            attr = options['attr']
        if coords and cats:
            gscript.fatal(
                _("With stvds it is not possible to use 'coordinates' "
                  "and 'cats' options together"))
        elif not coords and not cats:
            gscript.warning(
                _("With stvds you have to use 'coordinates' or "
                  "'cats' option"))
    title = None
    if options['title']:
        title = options['title']
    xlabel = None
    if options['xlabel']:
        xlabel = options['xlabel']
    ylabel = None
    if options['ylabel']:
        ylabel = options['ylabel']
    csvfile = None
    if options['csv']:
        csvfile = options['csv']
    app = wx.App()
    frame = TplotFrame(parent=None, giface=StandaloneGrassInterface())
    frame.SetDatasets(rasters, vectors, coords, cats, attr, title, xlabel,
                      ylabel, csvfile, flags['h'], gscript.overwrite)
    if output:
        frame.OnRedraw()
        if options['size']:
            sizes = options['size'].strip().split(',')
            sizes = [int(s) for s in sizes]
            frame.canvas.SetSize(sizes)
        frame.canvas.figure.savefig(output)
    else:
        frame.Show()
        app.MainLoop()
Exemplo n.º 29
0
        xx = a4x - mleft - mright

    # ひとつのグラフの高さ(mm)を計算
    if n > 1:
        yy = (a4y - mbottom - mtop - my * (n - 1)) / n
    else:
        yy = a4y - mbottom - mtop

    figure1.subplots_adjust(left=mleft / a4x,
                            bottom=mbottom / a4y,
                            right=(a4x - mright) / a4x,
                            top=(a4y - mtop) / a4y,
                            wspace=mx / xx,
                            hspace=my / yy)
    #
    # #     x = np.arange(nn) * dt  # 波形グラフの時間データの作成
    #     import random

    for i in range(ch):
        draw(sb2[i], x, y[:, i])


if __name__ == '__main__':
    app = wx.App()
    #     fx = 800
    #     fy = 800
    #     s1=wx.Size(fx,fy)
    frame2 = NIDaqFrame(None)
    frame2.Show()
    app.MainLoop()
Exemplo n.º 30
0
def main():
    my_app = wx.App()
    main_win = MainWindow(None)
    my_app.MainLoop()