Example #1
0
def main():
    gtk3.main()
Example #2
0
#now create our class base on that context:
import cube
javascript.export_module(web.get_env(), cube)

            
#and show it!
window.show_all()
from pyggi.javascript import jquery
from pyggi import gobject
from pyggi.webkit3_enums import *


def change( index, obj):
    _ = jquery._
    logging.error("CHANGE!!!!!!!!")
    if index%3 == 0:
        color = "#CC%d%d%d%d"%(index,index, index, index)
    elif index%3 == 1:
        color = "#%d%dAA%d%d"%(index,index, index, index)
    else:
        color = "#%d%d%d%d88"%(index,index, index, index)

    logging.error("########### COLOR %s %s %s"%(color, index, obj))
    _(obj).css('background-color',color)
    
    return True


#gobject.idle_add( jquery.initialize,web)
gtk3.main()
Example #3
0
def main():
    gtk3.main()
Example #4
0
#which by the nature of it being a GTK callback,
#will be executed in the main thread
web.on_view_ready(set_bg, "red")
gobject.timeout_add(1000, set_bg)
#add our web view to the main window, and set properties
window.add(web)
window.set_default_size(250, 100)
window.set_title("PyWebkit with CSS 3D ala Python")

#get the context for the javascript environment:
frame = web.get_main_frame()
context = frame.get_global_context()
#create a class available to javascript, The YPR_Updater class
#is made available to javascript simply by inheriting from JavascriptClass
#Javascript code can create a python YPR_Updater object view the
#"cube.YPR_Updater.new_ method
from cube import YPR_Updater
YPR_Updater.web = web

#now create all classes under cube by exporting that module:
#We must provide an execution context (environment) which is done
#via the get_env() call.  This will also initialize jQuery python
#interface module if not already initialized
import cube
javascript.export_module(web.get_env(), cube)
jq = jquery.initialize(web.get_env(), web.on_view_ready)

#and show it!
window.show_all()
gtk3.main()