Python wx 模块,Frame() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.Frame()

项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu,"File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()

    runT = Thread(target=app.MainLoop)
    runT.setDaemon(True)    
    runT.start()
    print(runT)
    print('createThread():', runT.isAlive())
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__ (self):
        wx.Frame.__init__ (self, None, title="Clipboard viewer", size=(250,150))

        self.first   = True
        self.nextWnd = None

        # Get native window handle of this wxWidget Frame.
        self.hwnd    = self.GetHandle ()

        # Set the WndProc to our function.
        self.oldWndProc = win32gui.SetWindowLong (self.hwnd,
                                                  win32con.GWL_WNDPROC,
                                                  self.MyWndProc)

        try:
            self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd)
        except win32api.error:
            if win32api.GetLastError () == 0:
                # information that there is no other window in chain
                pass
            else:
                raise
项目:Crypter    作者:sithis993    | 项目源码 | 文件源码
def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )

        BodySizer = wx.BoxSizer( wx.VERTICAL )

        self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        TextCtrlSizer = wx.BoxSizer( wx.VERTICAL )

        self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY )
        TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 )


        self.m_panel4.SetSizer( TextCtrlSizer )
        self.m_panel4.Layout()
        TextCtrlSizer.Fit( self.m_panel4 )
        BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 )


        self.SetSizer( BodySizer )
        self.Layout()

        self.Centre( wx.BOTH )
项目:Digital-Assistants    作者:ab-anand    | 项目源码 | 文件源码
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.''')
项目:Netkeeper    作者:1941474711    | 项目源码 | 文件源码
def OnInit(self):
        # ?????
        xml = XmlNode()
        if not xml.LoadFile(C_CONFIG_PATH):
            logging.error('???????')
            return False
        timelen = xml.FindNode('time').GetInt()
        if timelen <= 0:
            logging.error('??????????0?')
            return False
        services = xml.FindNode('services').GetChildrenList(tag='item')
        if len(services) == 0:
            logging.error('??????????')
            return False
        self.taskbar = TaskIcon()
        self.frame = Frame(timelen, services)
        return True
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, parent, id, title):

        wx.Frame.__init__(self, parent, id, title, size=(400, 250))


        panel = wx.Panel(self, wx.ID_ANY)
        panel.SetBackgroundColour('#000000')

        text = """\n \t \t \t    E-Z Music Downloader v1.0 \n \n Type in the song you want to downloading the the first box like so: "Song name by Artist" make sure you have both the artist and the song name in the query, in the second box type in what you want to name the Mp3. Next select High quality or Medium quality. High quality creates a larger file, therefore takes longer to convert. The status bar will show the actions the program is doing, once the status bar says done you can download another. To change the directory in which the song downloads, go to options in the menu bar and select "ChangeDownloadDirectory". \n \n \t \t  Thanks for chosing E-Z Musick Downloader! \n \n \t   (Songs converted using http://www.convertmemp3.com )"""

        txt = wx.StaticText(panel, label=text)
        txt.SetForegroundColour('#FFFFFF')
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(txt, 1, wx.EXPAND|wx.ALIGN_CENTER, 5)

        panel.SetSizer(sizer)

        self.Show()
        self.Centre()
项目:PandasDataFrameGUI    作者:bluenote10    | 项目源码 | 文件源码
def __init__(self, df):
        wx.Frame.__init__(self, None, -1, "Pandas DataFrame GUI")

        # Here we create a panel and a notebook on the panel
        p = wx.Panel(self)
        nb = wx.Notebook(p)
        self.nb = nb

        columns = df.columns[:]

        self.CreateStatusBar(2, style=0)
        self.SetStatusWidths([200, -1])

        # create the page windows as children of the notebook
        self.page1 = DataframePanel(nb, df, self.status_bar_callback)
        self.page2 = ColumnSelectionPanel(nb, columns, self.page1.df_list_ctrl)
        self.page3 = FilterPanel(nb, columns, self.page1.df_list_ctrl, self.selection_change_callback)
        self.page4 = HistogramPlot(nb, columns, self.page1.df_list_ctrl)
        self.page5 = ScatterPlot(nb, columns, self.page1.df_list_ctrl)

        # add the pages to the notebook with the label to show on the tab
        nb.AddPage(self.page1, "Data Frame")
        nb.AddPage(self.page2, "Columns")
        nb.AddPage(self.page3, "Filters")
        nb.AddPage(self.page4, "Histogram")
        nb.AddPage(self.page5, "Scatter Plot")

        nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_tab_change)

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer)

        self.SetSize((800, 600))
        self.Center()
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def __init__(self, parent, id, title, size,style):
        self.parent = parent
        self.screenSize = wx.DisplaySize()
        #self.screenSize = [ 786, 768 ]
        self.screenWidth = int(self.screenSize[0] / 3)
        self.screenHeight = int(self.screenSize[1] / 2)
        #fontsy = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize()        
        wx.Frame.__init__(self, parent, id, title, size=(400, 600), style=wx.DEFAULT_FRAME_STYLE)

        try:
            dosiero = open(os.path.join(os.path.expanduser("~"), '.config', 'stopgo.conf.json'))
            myprefs = json.load(dosiero)
        except:
            #print("No config found.") #DEBUG
            pass

        self.InitUI(myprefs)
        self.Show()
项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def __init__(self, parent=None, app_name=None, app_version=None, app_url=None, *args, **kwargs):
        """Initialize the UploaderAppFrame

        Args:
            parent: the parent of this Frame
            app_name: the name of the application (used as the window title and
                in the about dialog)
            app_version: the version of the application (used in the about dialog)
            app_url: the url of the application (used in the about dialog)
        """
        wx.Frame.__init__(self, parent, *args, **kwargs)
        self._app_name = app_name
        self._app_version = app_version
        self._app_url = app_url

        self._build_menu()
        UploaderAppPanel(self)

        self.SetTitle(self._app_name)
        self.SetSizeHints(400, 600,  # min window size
                          800, 700) # max window size (miseq has 1024x768 display resolution)
        self.Show(True)
项目:grid    作者:russelg    | 项目源码 | 文件源码
def __init__(self, size=(300, 300), pos=(100, 100)):

        wx.Frame.__init__(self, None, title="Am I transparent?",
                          style=wx.SIMPLE_BORDER | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR)
        self.SetClientSize(size)
        self.SetPosition(pos)

        self.alphaValue = 220
        self.alphaIncrement = -4

        pnl = wx.Panel(self)
        # self.changeAlpha_timer = wx.Timer(self)
        # self.changeAlpha_timer.Start(50)
        # self.Bind(wx.EVT_TIMER, self.ChangeAlpha)
        self.MakeTransparent(self.alphaValue)

        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, parent, log):
                self.log = log
                wx.Panel.__init__(self, parent, -1)
                note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs")
                note2 = wx.StaticText(self, -1, "a separate frame")
                b = wx.Button(self, -1, "Open Demo Frame Now")
                b.Bind(wx.EVT_BUTTON, self.OnButton)

                S = wx.BoxSizer(wx.VERTICAL)
                S.Add((10, 10), 1)
                S.Add(note1, 0, wx.ALIGN_CENTER)
                S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5)
                S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5)
                S.Add((10, 10), 1)
                self.SetSizer(S)
                self.Layout()
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self,None,-1,
                         'CanvasFrame',size=(550,350))



        self.SetBackgroundColour(wx.NamedColor("WHITE"))

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)

        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(self.sizer)
        self.Fit()

        self.add_toolbar()  # comment this out for no toolbar

        self.axes.set_title("NURBS and B-Spline Algorithms: ")
项目:opc-rest-api    作者:matzpersson    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
                          title='Moogle HTTP to OPC Server', size=(800,600) )

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.row_colours = { 'rest': 'blue', 'opc': 'purple'}

        ## -- Configure Top Tool bar 
        tb = wx.ToolBar(self, style=TBFLAGS)
        sizer.Add(tb, 0, wx.EXPAND)
        tsize = (24,24)
        tb.SetToolBitmapSize(tsize)
        tb.Realize()

        self.list =  wx.ListCtrl(self, -1,
            style=wx.LC_REPORT 
            #| wx.BORDER_SUNKEN
            #| wx.BORDER_NONE
            | wx.LC_EDIT_LABELS
            | wx.LC_SORT_ASCENDING
            | wx.LC_NO_HEADER
            | wx.LC_VRULES
            | wx.LC_HRULES
            #| wx.LC_SINGLE_SEL
            ) 
        self.loadListviewHeader()

        sizer.Add(self.list, 1, wx.EXPAND)

        self.SetSizer(sizer)
        sizer.Layout()

        self.Bind(wx.EVT_CLOSE, self.onClose)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def PrintPreview(self):
        """Print-preview current plot."""
        printout = PlotPrintout(self)
        printout2 = PlotPrintout(self)
        self.preview = wx.PrintPreview(printout, printout2, self.print_data)
        if not self.preview.IsOk():
            wx.MessageDialog(self, "Print Preview failed.\n"
                             "Check that default printer is configured\n",
                             "Print error", wx.OK | wx.CENTRE).ShowModal()
        self.preview.SetZoom(40)
        # search up tree to find frame instance
        frameInst = self
        while not isinstance(frameInst, wx.Frame):
            frameInst = frameInst.GetParent()
        frame = wx.PreviewFrame(self.preview, frameInst, "Preview")
        frame.Initialize()
        frame.SetPosition(self.GetPosition())
        frame.SetSize((600, 550))
        frame.Centre(wx.BOTH)
        frame.Show(True)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self, parent=None, fdir='./', title='pyDataViewer', 
                 size=(800,600), **kwargs):

        wx.Frame.__init__(self,parent,title=title,size=size)
        try:
            _icon = wx.EmptyIcon()
            _icon.CopyFromBitmap(
                # postproclib.visualiser.__path__ (pplvpath) is a list
                wx.Bitmap(pplvpath[0]+"/logo.gif", wx.BITMAP_TYPE_ANY)
            )
            self.SetIcon(_icon)
        except IOError:
            print('Couldn\'t load icon')

        self.dirchooser = DirectoryChooserPanel(self, fdir)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.dirchooser, 0, wx.EXPAND, 0)
        self.SetSizer(self.vbox)

        self.visualiserpanel = None
        self.new_visualiserpanel(fdir)
        self.fdir = fdir

        self.set_bindings()
项目:python_2048    作者:OATOMO    | 项目源码 | 文件源码
def __init__(self,title):
        super(Frame,self).__init__(None,-1,title,style=wx.DEFAULT_FRAME_STYLE^wx.MAXIMIZE_BOX^wx.RESIZE_BORDER)
        self.colors = {0:(204,192,179),2:(238, 228, 218),4:(237, 224, 200),8:(242, 177, 121),16:(245, 149, 99),32:(246, 124, 95),64:(246, 94, 59),128:(237, 207, 114),256:(237, 207, 114),512:(237, 207, 114),1024:(237, 207, 114),2048:(237, 207, 114),4096:(237, 207, 114),8192:(237, 207, 114),16384:(237, 207, 114),32768:(237, 207, 114),65536:(237, 207, 114),131072:(237, 207, 114),262144:(237, 207, 114),524288:(237, 207, 114),1048576:(237, 207, 114),2097152:(237, 207, 114),4194304:(237, 207, 114),8388608:(237, 207, 114),16777216:(237, 207, 114)}#?????????

        self.setIcon()
        self.initGame()
        self.initBuffer()

        panel = wx.Panel(self)  #??????
        #------????
        panel.Bind(wx.EVT_KEY_DOWN,self.onKeyDown)
        panel.SetFocus() #?????
        self.Bind(wx.EVT_SIZE,self.onSize) #use wx.BufferedPaintDC
        self.Bind(wx.EVT_PAINT,self.onPaint)
        self.Bind(wx.EVT_CLOSE,self.onClose) #????
        #------

        self.SetClientSize((505,720)) #??????
        self.Center() #?????
        self.Show()
项目:Portfolio    作者:rebeccapizano    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          "File and Folder Dialogs Tutorial")
        panel = wx.Panel(self, wx.ID_ANY)
        self.currentDirectory = os.getcwd()

        # create the buttons and bindings
        dirDlgBtn1 = wx.Button(panel, label="Choose Source")
        dirDlgBtn1.Bind(wx.EVT_BUTTON, self.onDir1)

        dirDlgBtn2 = wx.Button(panel, label="Choose Destination")
        dirDlgBtn2.Bind(wx.EVT_BUTTON, self.onDir2)

        moveBtn=wx.Button(panel, label="Check and Move Files")
        moveBtn.Bind(wx.EVT_BUTTON, self.moveUFiles) 

        # put the buttons in a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(dirDlgBtn1, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(dirDlgBtn2, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(moveBtn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: secret_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, "School Name")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "School Code")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Save")
        self.DB=db_operations()
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1)
        self.on_load()
        self.Center()
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: secret_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, "School Name")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "School Code")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Save")
        self.DB=db_operations()
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1)
        self.on_load()
        self.Center()
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sms_dialoge.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.THICK_FRAME
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_5 = wx.Panel(self, wx.ID_ANY)
        self.label_7 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Username"))
        self.combo_box_1 = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=[("Select"), ("admin"), ("teacher")], style=wx.CB_READONLY|wx.CB_DROPDOWN)
        self.label_8 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Password"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_5, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_1 = wx.Button(self.panel_5, wx.ID_ANY, ("Cancel"))
        self.button_2 = wx.Button(self.panel_5, wx.ID_ANY, ("Login"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_user, self.combo_box_1)
        self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.on_login, self.button_2)

        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
        self.Bind(wx.EVT_CLOSE,self.on_close,self)
        self.UO=user_operations(self)
        # end wxGlade
项目:pywatch    作者:jackburridge    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Frame.__init__(self, parent, title=u"My Frame")

        self.model = WatchableDict()
        self.model["text"] = ""

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer.Add(self.text_ctrl, 0, 0, 0)
        pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text")

        self.static_text = wx.StaticText(self, wx.ID_ANY, u"Text: {0}", wx.DefaultPosition, wx.DefaultSize, 0)
        sizer.Add(self.static_text, 0, 0, 0)
        pywatch.wx.LabelWatcher(self.static_text, self.model, "text")

        self.SetSizer(sizer)

        self.Centre(wx.BOTH)
项目:Project-Console-Game-Localization    作者:wmltogether    | 项目源码 | 文件源码
def __init__(self, parent, title = u"KUON FONT TOOL"):
        wx.Frame.__init__(self, parent, -1, title,pos=(150, 150), size=(400, 360))
        panel = wx.Panel(self, -1)
        self.button = wx.Button(panel, -1, u"??????", pos=(50, 20))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 20))
        self.Bind(wx.EVT_BUTTON, self.OnClick_expng,self.button)
        self.button.SetDefault()

        self.button1 = wx.Button(panel, -1, u"?????", pos=(50, 60))
        wx.StaticText(panel ,-1 ,u"?????" ,(200, 60))
        self.Bind(wx.EVT_BUTTON, self.OnClick_excharlist,self.button1)
        self.button1.SetDefault()

        self.button2 = wx.Button(panel, -1, u"??????", pos=(50, 100))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 100))
        self.Bind(wx.EVT_BUTTON, self.OnClick_exfont_info,self.button2)
        self.button2.SetDefault()

        self.button3 = wx.Button(panel, -1, u"??????", pos=(50, 140))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 140))
        self.Bind(wx.EVT_BUTTON, self.OnClick_buildfont,self.button3)
        self.button3.SetDefault()


        self.Show()
项目:cx_Freeze    作者:anthony-tuininga    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, parent=None, title='Hello from cx_Freeze')
        panel = wx.Panel(self)
        closeMeButton = wx.Button(panel, -1, 'Close Me')
        self.Connect(closeMeButton.GetId(), -1, wx.EVT_BUTTON.typeId,
                self.OnCloseMe)
        self.Connect(self.GetId(), -1, wx.EVT_CLOSE.typeId, self.OnCloseWindow)
        pushMeButton = wx.Button(panel, -1, 'Push Me')
        self.Connect(pushMeButton.GetId(), -1, wx.EVT_BUTTON.typeId,
                self.OnPushMe)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(closeMeButton, flag=wx.ALL, border=20)
        sizer.Add(pushMeButton, flag=wx.ALL, border=20)
        panel.SetSizer(sizer)
        topSizer = wx.BoxSizer(wx.VERTICAL)
        topSizer.Add(panel, flag=wx.ALL | wx.EXPAND)
        topSizer.Fit(self)
项目:Automation-Bots    作者:ab-anand    | 项目源码 | 文件源码
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='KIARA')
        panel = wx.Panel(self)
        my_sizer = wx.BoxSizer(wx.VERTICAL)
        lbl = wx.StaticText(panel, label='''Hello I\'m Kiara the Python
                            Digital Assistant. 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('Welcome my friend. I am Kiara. How can I help ?')
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        """Constructor"""
        title = 'Get Children from Sizer'
        wx.Frame.__init__(self, None, title=title)
        panel = wx.Panel(self)

        lbl = wx.StaticText(panel, label="I'm a label!")
        txt = wx.TextCtrl(panel, value="blah blah")
        btn = wx.Button(panel, label="Clear")
        btn.Bind(wx.EVT_BUTTON, self.onClear)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(lbl, 0, wx.ALL, 5)
        self.sizer.Add(txt, 0, wx.ALL, 5)
        self.sizer.Add(btn, 0, wx.ALL, 5)

        panel.SetSizer(self.sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, 
                          "Background Reset Tutorial")

        # Add a panel so it looks the correct on all platforms
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.txt = wx.TextCtrl(self.panel)
        self.txt.SetBackgroundColour("Yellow")

        blueBtn = wx.Button(self.panel, 
                            label="Change Background Color")
        blueBtn.Bind(wx.EVT_BUTTON, self.onChangeBackground)
        resetBtn = wx.Button(self.panel, label="Reset")
        resetBtn.Bind(wx.EVT_BUTTON, self.onReset)

        topSizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        btnSizer.Add(blueBtn, 0, wx.ALL|wx.CENTER, 5)
        btnSizer.Add(resetBtn, 0, wx.ALL|wx.CENTER, 5)

        topSizer.Add(self.txt, 0, wx.ALL, 5)
        topSizer.Add(btnSizer, 0, wx.CENTER)
        self.panel.SetSizer(topSizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Tutorial")

        self.eventDict = {}
        evt_names = [x for x in dir(wx) if x.startswith("EVT_")]
        for name in evt_names:
            evt = getattr(wx, name)
            if isinstance(evt, wx.PyEventBinder):
                self.eventDict[evt.typeId] = name

        grid_evt_names = [x for x in dir(wx.grid) if x.startswith("EVT_")]
        for name in grid_evt_names:
            evt = getattr(wx.grid, name)
            if isinstance(evt, wx.PyEventBinder):
                self.eventDict[evt.typeId] = name

        panel = wx.Panel(self, wx.ID_ANY)
        btn = wx.Button(panel, wx.ID_ANY, "Get POS")

        btn.Bind(wx.EVT_BUTTON, self.onEvent)
        panel.Bind(wx.EVT_LEFT_DCLICK, self.onEvent)
        panel.Bind(wx.EVT_RIGHT_DOWN, self.onEvent)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title="Center the Button")
        panel = wx.Panel(self)

        h_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        btn = wx.Button(panel, label="Centered")
        h_sizer.Add(btn, 0, wx.CENTER)

        main_sizer.Add((0,0), 1, wx.EXPAND)
        main_sizer.Add(h_sizer, 0, wx.CENTER)
        main_sizer.Add((0,0), 1, wx.EXPAND)

        panel.SetSizer(main_sizer)

        self.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title="Center the Button")
        panel = wx.Panel(self)

        h_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        btn = wx.Button(panel, label="Centered")
        h_sizer.Add(btn, 0, wx.CENTER)

        main_sizer.AddStretchSpacer(prop=1)
        main_sizer.Add(h_sizer, 0, wx.CENTER)
        main_sizer.AddStretchSpacer(prop=1)

        panel.SetSizer(main_sizer)

        self.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title='Richtext Test')

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.rt = wx.richtext.RichTextCtrl(self)
        self.rt.SetMinSize((300,200))

        save_button = wx.Button(self, label="Save")
        save_button.Bind(wx.EVT_BUTTON, self.on_save)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rt, 1, wx.EXPAND|wx.ALL, 6)
        sizer.Add(save_button, 0, wx.EXPAND|wx.ALL, 6)

        self.SetSizer(sizer)
        self.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, redirect=False, filename=None):
        wx.App.__init__(self, redirect, filename)

        BASEURL = "http://127.0.0.1:8000"
        self.InitUpdates(BASEURL,
                         BASEURL + "/" + 'ChangeLog.txt')
        self.SetAppDisplayName('Image Viewer')
        self.CheckForUpdate()

        self.frame = wx.Frame(None, title='Photo Control')

        self.panel = wx.Panel(self.frame)

        self.PhotoMaxSize = 500

        self.createWidgets()
        self.frame.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Timer Tutorial 2")

        panel = wx.Panel(self, wx.ID_ANY)

        self.timer = wx.Timer(self, id=TIMER_ID1)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer2 = wx.Timer(self, id=TIMER_ID2)
        self.Bind(wx.EVT_TIMER, self.update, self.timer2)

        self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimerOne)
        self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2")
        self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimerOne)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="wxPython Redirect Tutorial")

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100),
                          style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        btn = wx.Button(panel, wx.ID_ANY, 'Push me!')
        self.Bind(wx.EVT_BUTTON, self.onButton, btn)

        # Add widgets to a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)

        # redirect text here
        redir = RedirectText(log)
        sys.stdout = redir
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None,
                          title="wxPython Redirect Tutorial")

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL
        log = MyCustomTextCtrl(panel, wx.ID_ANY, size=(300,100),
                               style=style)
        btn = wx.Button(panel, wx.ID_ANY, 'Push me!')
        self.Bind(wx.EVT_BUTTON, self.onButton, btn)

        # Add widgets to a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)

        # redirect text here
        sys.stdout = log
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None,
                          title="wxPython Redirect Tutorial")

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL
        log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100),
                          style=style)
        btn = wx.Button(panel, wx.ID_ANY, 'Push me!')
        self.Bind(wx.EVT_BUTTON, self.onButton, btn)

        # Add widgets to a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)

        # redirect text here
        sys.stdout = log
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          'It Looks Like a Line Graph!')

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)

        # create some sizers
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        checkSizer = wx.BoxSizer(wx.HORIZONTAL)

        # create the widgets
        self.canvas = PlotCanvas(panel)
        self.canvas.Draw(drawLinePlot())
        toggleGrid = wx.CheckBox(panel, label="Show Grid")
        toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid)
        toggleLegend = wx.CheckBox(panel, label="Show Legend")
        toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend)

        # layout the widgets
        mainSizer.Add(self.canvas, 1, wx.EXPAND)
        checkSizer.Add(toggleGrid, 0, wx.ALL, 5)
        checkSizer.Add(toggleLegend, 0, wx.ALL, 5)
        mainSizer.Add(checkSizer)
        panel.SetSizer(mainSizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          'Sin / Cos Plot')

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)

        # create some sizers
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        checkSizer = wx.BoxSizer(wx.HORIZONTAL)

        # create the widgets
        self.canvas = PlotCanvas(panel)
        self.canvas.Draw(drawSinCosWaves())
        toggleGrid = wx.CheckBox(panel, label="Show Grid")
        toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid)
        toggleLegend = wx.CheckBox(panel, label="Show Legend")
        toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend)

        # layout the widgets
        mainSizer.Add(self.canvas, 1, wx.EXPAND)
        checkSizer.Add(toggleGrid, 0, wx.ALL, 5)
        checkSizer.Add(toggleLegend, 0, wx.ALL, 5)
        mainSizer.Add(checkSizer)
        panel.SetSizer(mainSizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, parent):

        wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400,400))

        html = wxHTML(self)

        html.SetPage(
            ''

            "<h2>About the About Tutorial</h2>"

            "<p>This about box is for demo purposes only. It was created in June 2006"

            "by Mike Driscoll.</p>"

            "<p><b>Software used in making this demo:</h3></p>"

            '<p><b><a href="http://www.python.org">Python 2.4</a></b></p>'

            '<p><b><a href="http://www.wxpython.org">wxPython 2.8</a></b></p>'
        )
项目:pyupdater-wx-demo    作者:wettenhj    | 项目源码 | 文件源码
def OnInit(self):
        """
        Run automatically when the wxPython application starts.
        """
        self.frame = wx.Frame(None, title="PyUpdater wxPython Demo")
        self.frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        self.frame.SetSize(wx.Size(400, 100))
        self.statusBar = wx.StatusBar(self.frame)
        self.statusBar.SetStatusText(self.status)
        self.frame.SetStatusBar(self.statusBar)
        self.panel = wx.Panel(self.frame)
        self.sizer = wx.BoxSizer()
        self.sizer.Add(
            wx.StaticText(self.frame, label="Version %s" % __version__))
        self.panel.SetSizerAndFit(self.sizer)

        self.frame.Show()

        if hasattr(sys, "frozen") and \
                not os.environ.get('PYUPDATER_FILESERVER_DIR'):
            dlg = wx.MessageDialog(
                self.frame,
                "The PYUPDATER_FILESERVER_DIR environment variable "
                "is not set!", "PyUpdaterWxDemo File Server Error",
                wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()

        return True
项目:Netkeeper    作者:1941474711    | 项目源码 | 文件源码
def __init__(self, timelen, services):
        wx.Frame.__init__(self, parent=None, title=C_APP_NAME)
        self.timelen = timelen * 1000
        self.services = services
        self.Show(False)
        self.Bind(wx.EVT_TIMER, self.OnTimerEvent)
        self.Bind(wx.EVT_CLOSE, self.OnExitEvent)
        self.timer = wx.Timer(self)
        self.timer.Start(self.timelen)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, -1, title, size = (1, 1),
            style=wx.FRAME_NO_TASKBAR|wx.NO_FULL_REPAINT_ON_RESIZE)

        self.tbicon = MyTaskBarIcon(self)
        self.tbicon.SetIconTimer()

        self.Show(True)

##
# The main application wx.App class
#
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: ChatFrameGui.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_2 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL)
        self.panel_1 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL)
        self.panel_3 = wx.Panel(self.panel_1, -1)
        self.panel_4 = wx.Panel(self.panel_1, -1)
        self.frmMain_statusbar = self.CreateStatusBar(1)
        self.lblIpAddress = wx.StaticText(self.panel_4, -1, "IP &Address")
        self.edtIPAddress = wx.TextCtrl(self.panel_4, -1, "127.0.0.1")
        self.spnConnectPort = wx.SpinCtrl(self.panel_4, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP)
        self.btnConnect = wx.ToggleButton(self.panel_4, -1, "&Connect")
        self.lblListenPort = wx.StaticText(self.panel_3, -1, "Listen &on port")
        self.spnListenPort = wx.SpinCtrl(self.panel_3, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP)
        self.btnListen = wx.ToggleButton(self.panel_3, -1, "Lis&ten")
        self.lblReceived = wx.StaticText(self.panel_1, -1, "Received")
        self.edtReceived = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL)
        self.lblSent = wx.StaticText(self.panel_1, -1, "Sent:")
        self.edtSent = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL)
        self.edtToSend = wx.TextCtrl(self.panel_2, -1, "")
        self.btnSend = wx.Button(self.panel_2, -1, "&Send")
        self.btnClose = wx.Button(self.panel_2, -1, "&Close")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
项目:Gym_LineFollower    作者:Chachay    | 项目源码 | 文件源码
def __init__(self, parent=None, id=-1, title=None):
        wx.Frame.__init__(self, parent, id, title)
        self.MainPanel = wx.Panel(self, size=(640, 480))
        self.MainPanel.SetBackgroundColour('WHITE')

        self.panel = wx.Panel(self.MainPanel, size = (640,480))
        self.panel.SetBackgroundColour('WHITE')

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.panel)

        self.SetSizer(mainSizer)
        self.Fit()

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

        self.World = None

        self.cdc = wx.ClientDC(self.panel)
        w, h = self.panel.GetSize()
        self.bmp = wx.EmptyBitmap(w,h)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)

        self.timer.Start(20)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu,"File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()
    app.MainLoop()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def createWidgetsFrame(self):
        staticBox = wx.StaticBox( self.panel, -1, "Widgets Frame", size=(285, -1) )   
        self.statBoxSizerV = wx.StaticBoxSizer(staticBox, wx.VERTICAL)   

    #----------------------------------------------------------
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def addStaticBoxWithLabels(self):
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" )
        staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL )
        boxSizerV = wx.BoxSizer( wx.VERTICAL )
        staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" )
        boxSizerV.Add( staticText1, 0, wx.ALL)
        staticText2 = wx.StaticText( self.panel, -1, "           Label 2")
        boxSizerV.Add( staticText2, 0, wx.ALL )
        #------------------------------------------------------
        staticBoxSizerV.Add( boxSizerV, 0, wx.ALL )
        boxSizerH.Add(staticBoxSizerV)
        #------------------------------------------------------
        boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1)))
        #------------------------------------------------------
        boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED))             

        # Add local boxSizer to main frame
        self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL )

    #----------------------------------------------------------
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        self.createWidgets()
        self.Show()
    #----------------------------------------------------------
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def wxPythonApp():
    import wx
    app = wx.App()
    frame = wx.Frame(None, -1, "wxPython GUI", size=(200,150))
    frame.SetBackgroundColour('white')
    frame.CreateStatusBar()
    menu= wx.Menu()
    menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
    menuBar = wx.MenuBar()
    menuBar.Append(menu, "File") 
    frame.SetMenuBar(menuBar)     
    frame.Show()
    app.MainLoop()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent, title, size=(200,100)):
        # Initialize super class
        wx.Frame.__init__(self, parent, title=title, size=size)

        # Change the frame color 
        self.SetBackgroundColour('white')

        # Create Status Bar
        self.CreateStatusBar() 

        # Create the Menu
        menu= wx.Menu()

        # Add Menu Items to the Menu
        menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
        menu.AppendSeparator()
        menu.Append(wx.ID_EXIT,"Exit"," Exit the GUI")

        # Create the MenuBar
        menuBar = wx.MenuBar()
        # Give the Menu a Title
        menuBar.Append(menu,"File") 

        # Connect the Menu to the frame
        self.SetMenuBar(menuBar)  

        # Display the frame
        self.Show()

# Create instance of wxPython application
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def buttonCallback(self, event):
        self.textWidget.AppendText("Enjoy 3-Dimensional Space in Python.") 
        self.textWidget.AppendText("\n*** Use your mouse to spin the Cube! ***\n\n")
        frame = wx.Frame(None, -1, title='Python OpenGL', size=(300, 300), pos=(400, 20))
        CubeCanvas(frame) 
        frame.Show()