Exemple #1
0
from pyggi.gtk3 import GtkWindow, GtkScrolledWindow
from pyggi import gtk3
from pyggi.webkit3 import WebKitWebView

#Create the GUI component stack
window = GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
window.set_default_size(1200, 800)
window.set_title("Example2: Use Python to Manipulate a Javascript Element")
scrolled = GtkScrolledWindow(None, None)
window.add(scrolled)
webview = WebKitWebView()
scrolled.add(webview)

#open the example html in the view and show all components
import os.path
webview.open(
    os.path.join(os.path.dirname(os.path.abspath(__file__)), "example2.html"))
window.show_all()

#setup the environment and get the javascript object
color_block = None
#must get the object only when javascript has been processed,
#so setup callback
context = webview.get_main_frame().get_global_context()


def tryit(*args):
    window = context.get_jsobject("window")
    window.alert("Test of setTimeout callback into Python")


def import_element():
Exemple #2
0
#!/usr/bin/env python
from pyggi.gtk3 import GtkWindow, GtkScrolledWindow
from pyggi import gtk3
from pyggi.webkit3 import WebKitWebView

window = GtkWindow( gtk3.GTK_WINDOW_TOPLEVEL )
window.set_default_size( 1200, 800 )
window.set_title("Example1: Load a Web Page")
scrolled = GtkScrolledWindow( None, None )
window.add( scrolled )
webview = WebKitWebView()
scrolled.add( webview )

webview.open( "http://www.python.org" )

window.show_all()
window.connect( "delete-event", gtk3.main_quit )

def main():
    gtk3.main()

if __name__ == "__main__":
    main()
Exemple #3
0
from pyggi.webkit3 import WebKitWebView, WebKitWebSettings

window = GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
window.set_default_size(1200, 800)
window.set_title("Example1: Load a Web Page")
scrolled = GtkScrolledWindow(None, None)
window.add(scrolled)
webview = WebKitWebView()
settings = webview.get_settings()
statc = settings.set("enable-webgl", True, None)
webview.set_settings(settings)
aquarium.initialize_aquarium(webview.get_main_frame().get_global_context(),
                             webview.on_view_ready)
import logging
logging.error("ENABLE: ")
scrolled.add(webview)

#webview.open( "http://learningwebgl.com/lessons/lesson04/index.html" )
webview.open("file:///%s/aquarium.html" % os.path.dirname(__file__))
window.show_all()
window.connect("delete-event", gtk3.main_quit)


def main():

    gtk3.main()


if __name__ == "__main__":
    main()
Exemple #4
0
from pyggi.gtk3 import GtkWindow, GtkScrolledWindow
from pyggi import gtk3
from pyggi.webkit3 import WebKitWebView

#Create the GUI component stack
window = GtkWindow( gtk3.GTK_WINDOW_TOPLEVEL )
window.set_default_size( 1200, 800 )
window.set_title("Example2: Use Python to Manipulate a Javascript Element")
scrolled = GtkScrolledWindow( None, None )
window.add( scrolled )
webview = WebKitWebView()
scrolled.add( webview )

#open the example html in the view and show all components
import os.path
webview.open( os.path.join( os.path.dirname(os.path.abspath(__file__)),"example2.html" ))
window.show_all()


#setup the environment and get the javascript object
color_block = None
#must get the object only when javascript has been processed,
#so setup callback 
context = webview.get_main_frame().get_global_context()

def tryit(*args):
    window = context.get_jsobject("window")
    window.alert("Test of setTimeout callback into Python")

def import_element():
    window = context.get_jsobject("window")
Exemple #5
0
from pyggi.gtk3 import GtkWindow, GtkScrolledWindow
from pyggi import gtk3
from pyggi.webkit3 import WebKitWebView, WebKitWebSettings

window = GtkWindow( gtk3.GTK_WINDOW_TOPLEVEL )
window.set_default_size( 1200, 800 )
window.set_title("Example1: Load a Web Page")
scrolled = GtkScrolledWindow( None, None )
window.add( scrolled )
webview = WebKitWebView()
settings = webview.get_settings()
statc = settings.set( "enable-webgl", True, None )
webview.set_settings( settings )
aquarium.initialize_aquarium( webview.get_main_frame().get_global_context(), webview.on_view_ready)
import logging
logging.error("ENABLE: ")
scrolled.add( webview )

#webview.open( "http://learningwebgl.com/lessons/lesson04/index.html" )
webview.open("file:///%s/aquarium.html" % os.path.dirname(__file__))
window.show_all()
window.connect( "delete-event", gtk3.main_quit )


def main():
    
    gtk3.main()

if __name__ == "__main__":
    main()
Exemple #6
0
"""
import os.path
import sys
sys.path = [ os.path.abspath( os.path.join( os.path.dirname(__file__),"..", ".."))] + \
           sys.path

from pyggi.gtk3 import GtkWindow, GtkScrolledWindow
from pyggi import gtk3
from pyggi.webkit3 import WebKitWebView

window = GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
window.set_default_size(1200, 800)
window.set_title("Example1: Load a Web Page")
scrolled = GtkScrolledWindow(None, None)
window.add(scrolled)
webview = WebKitWebView()
scrolled.add(webview)

webview.open("http://www.python.org")

window.show_all()
window.connect("delete-event", gtk3.main_quit)


def main():
    gtk3.main()


if __name__ == "__main__":
    main()
Exemple #7
0
from pyggi.webkit3 import WebKitWebView, WebKitWebSettings

window = GtkWindow(gtk3.GTK_WINDOW_TOPLEVEL)
window.set_default_size(1200, 800)
window.set_title("Example1: Load a Web Page")
scrolled = GtkScrolledWindow(None, None)
window.add(scrolled)
webview = WebKitWebView()
settings = webview.get_settings()
statc = settings.set("enable-webgl", True, None)
webview.set_settings(settings)
aquarium.initialize_aquarium(webview.get_env(), webview.on_view_ready)
import logging

logging.error("ENABLE: ")
scrolled.add(webview)

#webview.open( "http://learningwebgl.com/lessons/lesson04/index.html" )
webview.open("http://webglsamples.googlecode.com/hg/aquarium/aquarium.html")
window.show_all()
window.connect("delete-event", gtk3.main_quit)


def main():

    gtk3.main()


if __name__ == "__main__":
    main()