def run(self): self.log.info('create menu') self.sys_icon() self.log.info('item to loop') gobject.timeout_add(10, self.check) self.log.info('start loop') gtk_.main() self.log.info('end run method')
def init_widget(self, mainwindow): self.mainwindow = mainwindow # init gui self.fileview.Reorderable = False self.fileview.AppendColumn("From", Gtk.CellRendererText(), "markup", 0, "background", 2) self.fileview.AppendColumn("To", Gtk.CellRendererText(), "markup", 1, "background", 3) self.fileview.Model = Gtk.ListStore(str, str, str, str) # events that signal window resize mainwindow.ExposeEvent += self.onWindowResize
def installTransparency(self, component): component.set_visual(component.get_screen().get_rgba_visual()) component.override_background_color(Gtk.StateFlags.ACTIVE, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.BACKDROP, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.DIR_LTR, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.DIR_RTL, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.FOCUSED, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.INCONSISTENT, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.INSENSITIVE, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.PRELIGHT, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.SELECTED, Gdk.RGBA(0, 0, 0, 0)) transparentWindowStyleProvider = Gtk.CssProvider() transparentWindowStyleProvider.load_from_data(""" GtkWindow { background-color: rgba(0, 0, 0, 0); background-image: none; } """) component.get_style_context().add_provider( transparentWindowStyleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def set_assemly_list(self): cols = [ ["Assembly", "text", 0], ["Version", "text", 1], ["Location", "text", 2], ] for (name, att, attid) in cols: self.assemblyview.AppendColumn(name, Gtk.CellRendererText(), att, attid) self.assemblyview.Model = Gtk.ListStore(str, str, str) assemblies = platform.get_assemblies() for ass in assemblies: assname = ass.GetName() name = str(assname.Name) ver = str(assname.Version) loc = '' if hasattr(ass, 'Location'): loc = str(ass.Location) self.assemblyview.Model.AppendValues(name, ver, loc)
def init_widget(self): self.init_glade_func(self) # init gui self.logwindow.Title = "Error log" self.logwindow.SetIconFromFile(self.parent.app_icon_path) self.logwindow.SetDefaultSize(440, 470) # setup tag table tag = Gtk.TextTag('em') tag.ForegroundGdk = gtkhelper.get_gdk_color_obj('red') tagtable = self.textview_log.Buffer.TagTable tagtable.Add(tag) # events self.logwindow.Shown += self.init_platform_info self.textview_log.Buffer.Changed += self.onTextBufferChanged self.button_close.Clicked += self.onClose
def __init__(self, url, transparent=False): Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL, title='') self.scrolls = Gtk.ScrolledWindow() self.webView = WebKit.WebView() self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.resize(1024, 600) self.installTransparency(self.scrolls) self.scrolls.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER) self.webView.set_transparent(True) self.webView.connect('title-changed', self.titleChanged) self.webView.load_uri(url) self.scrolls.add(self.webView) self.add(self.scrolls) if (transparent): self.set_decorated(False) self.installTransparency(self) self.installTransparency(self.webView)
def __init__(self, title): self.game = FlippingGame.FlippingGame() self.table = Gtk.Table(7, 2, True) self.table.Attach( Gtk.Label("Bankroll:"), 0, 1, 0, 1) self.bankrollLabel = Gtk.Label("") self.table.Attach( self.bankrollLabel, 1, 2, 0, 1) self.table.Attach( Gtk.Label("Wager:"), 0, 1, 1, 2) self.wagerBox = Gtk.Entry() self.table.Attach( self.wagerBox, 1, 2, 1, 2) self.table.Attach( Gtk.Label("Guess:"), 0, 1, 2, 3) self.guessHeadsButton = Gtk.RadioButton("Heads") self.table.Attach(self.guessHeadsButton, 1, 2, 2, 3) self.guessTailsButton = Gtk.RadioButton(self.guessHeadsButton, "Tails") self.table.Attach(self.guessTailsButton, 1, 2, 3, 4) self.flipButton = Gtk.Button("Flip!") self.flipButton.Clicked += self.flipButton_Click self.table.Attach( self.flipButton, 0, 2, 4, 5) self.resultLabel = Gtk.Label("") self.table.Attach( self.resultLabel, 0, 2, 5, 6) self.errorLabel = Gtk.Label("") self.table.Attach( self.errorLabel, 0, 2, 6, 7) self.Add(self.table) self.table.ShowAll() self._showBankroll()
def main(self): # All PyGTK applications must have a Gtk.main(). Control ends here # and waits for an event to occur (like a key press or mouse event). Gtk.main()
def destroy(self, widget, data=None): print "destroy signal occurred" Gtk.main_quit()
Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.PRELIGHT, Gdk.RGBA(0, 0, 0, 0)) component.override_background_color(Gtk.StateFlags.SELECTED, Gdk.RGBA(0, 0, 0, 0)) transparentWindowStyleProvider = Gtk.CssProvider() transparentWindowStyleProvider.load_from_data(""" GtkWindow { background-color: rgba(0, 0, 0, 0); background-image: none; } """) component.get_style_context().add_provider( transparentWindowStyleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) def titleChanged(self, webView, frame, title): self.set_title(title) if (__name__ == "__main__"): Gtk.init(sys.argv) mainWindow = WebKitWindow('http://www.google.com.br/', transparent=True) mainWindow.connect('delete-event', Gtk.main_quit) mainWindow.show_all() Gtk.main()
#!/usr/bin/env python import Gtk win = Gtk.Window() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main()
#!/usr/bin/env python import webkit, Gtk, os transparent_window_style_provider = Gtk.CssProvider() def load_finished(web): js = 'alert("a");' b.execute_script(js) winA = Gtk.Window() winA.fullscreen() winA.connect('destroy', lambda w: Gtk.main_quit()) winB = Gtk.Window() winB.fullscreen() winB.set_keep_above(1) winB.set_opacity(0.33) winB.connect('destroy', lambda w: Gtk.main_quit()) webA = webkit.WebView() webB = webkit.WebView() webB.set_transparent(1) webA.load_uri("https://www.google.com") webB.open("file:///home/ubuntu/gester/static/menu.html") winA.add(webA) winA.show_all()