Exemple #1
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 #2
0
#!/usr/bin/env python
import os.path
import sys
sys.path = [ os.path.dirname(__file__), os.path.abspath( os.path.join( os.path.dirname(__file__),"..", ".."))] + \
           sys.path

import aquarium
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)
Exemple #3
0
#!/usr/bin/env python
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

#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()
Exemple #4
0
#!/usr/bin/env python
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

#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()