Giter Site home page Giter Site logo

automate cefpython about cefpython HOT 4 CLOSED

magicyuuu avatar magicyuuu commented on July 20, 2024
automate cefpython

from cefpython.

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
You can execute arbitrary javascript on webpages, use 
Browser->GetMainFrame()->ExecuteJavascript("document.getElementById('lst-ib').va
lue='my search';")

Original comment by [email protected] on 9 Nov 2012 at 3:13

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024

Original comment by [email protected] on 9 Nov 2012 at 3:14

  • Changed state: Duplicate

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
could you show on this example:
# An example of embedding CEF in wxPython application.
#coding:utf-8

import wx
import sys
import time
import cefpython

# TODO: currently we use wx.Timer to imitate message loop, but
# it would probably be better to use wx.CallLater() and wx.lib.pubsub.

class MainFrame(wx.Frame):

    browser = None

    def __init__(self):

        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='wxPython example', size=(1000,800))
        self.CreateMenu()
        self.browser = cefpython.CreateBrowser(self.GetHandle(), browserSettings={}, navigateURL="http://google.com")       

        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.Bind(wx.EVT_SIZE, self.OnSize)

    def CreateMenu(self):

        filemenu = wx.Menu()
        filemenu.Append(1, "Открыть")
        filemenu.Append(2, "Выход")

        aboutmenu = wx.Menu()
        aboutmenu.Append(1, "CEF Python")

        menubar = wx.MenuBar()
        menubar.Append(filemenu,"&File")
        menubar.Append(aboutmenu, "&About")

        self.SetMenuBar(menubar)

    def OnSetFocus(self, event):

        cefpython.wm_SetFocus(self.GetHandle(), 0, 0, 0)

    def OnSize(self, event):

        cefpython.wm_Size(self.GetHandle(), 0, 0, 0)

class MyApp(wx.App):

    timer = None
    timerID = 1

    def OnInit(self):

        cefpython.Initialize()
        sys.excepthook = cefpython.ExceptHook

        self.timer = wx.Timer(self, self.timerID)
        self.timer.Start(10) # 10ms
        wx.EVT_TIMER(self, self.timerID, self.OnTimer)

        frame = MainFrame()
        self.SetTopWindow(frame)
        frame.Show()

        return True

    def OnExit(self):

        self.timer.Stop()
        cefpython.Shutdown()

    def OnTimer(self, event):

        cefpython.SingleMessageLoop()

if __name__ == '__main__':

    print('wx.version=%s' % wx.version())
    app = MyApp(False)
    app.MainLoop()

print list(sys.modules.keys())

Original comment by [email protected] on 12 Nov 2012 at 6:58

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
This is an issue tracker where you report bugs or feature requests, this is not 
a help forum.

Original comment by [email protected] on 13 Nov 2012 at 12:27

from cefpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.