Development Team/Almanac/Code Snippets: Difference between revisions
→Files: added get_activity_root snippet |
|||
| (15 intermediate revisions by 11 users not shown) | |||
| Line 1: | Line 1: | ||
{{Translations}} | {{Translations}} | ||
The [[Development_Team/Almanac|Sugar Almanac]] also has lots of code snippets. | |||
== Smooth animation == | == Smooth animation == | ||
| Line 6: | Line 7: | ||
[[PyGTK/Smooth_Animation_with_PyGTK]] | [[PyGTK/Smooth_Animation_with_PyGTK]] | ||
== WebView == | == WebKit WebView == | ||
from gi.repository import WebKit | |||
import | from gi.repository import Gtk | ||
from | |||
WINDOW_WIDTH, WINDOW_HEIGHT = 700, 500 | |||
# create window: | |||
def _destroy_cb(widget, data=None): | |||
Gtk.main_quit() | |||
window = Gtk.Window() | |||
window.resize(WINDOW_WIDTH, WINDOW_HEIGHT) | |||
window.connect("destroy", _destroy_cb) | |||
window.show() | |||
# create and add scrolled window: | |||
s = Gtk.ScrolledWindow() | |||
window.add(s) | |||
s.show() | |||
# create and add webview: | |||
v = WebKit.WebView() | |||
s.add(v) | |||
v.show() | |||
# load google page: | |||
v.load_uri('http://wiki.laptop.org') | |||
Gtk.main() | |||
== Toolbar == | == Toolbar == | ||
| Line 222: | Line 229: | ||
[[Category:HowTo]] | [[Category:HowTo]] | ||
[[Category:Sugar]] | [[Category:Sugar]] | ||
[[Category:Developer]] | |||