Question

I have had searched the web to find the way to put a name in the top of a PyQt4 application border. I saw setCaption() method ( like in http://nullege.com/codes/search/PyQt4.QtGui.QDialog.setCaption ) but I don't know how to use it and if it's the good method ( I have had tested browser.setCaption("foobar") ) My app is based on spynner, maybe I should import PyQt4.QtGui.QDialog in my script ? Any example will be really appreciated :)

This is the whole code ( can be run as-is ) :

#!/usr/bin/python2
# -*- coding: utf8 -*-
# vim:ts=4:sw=4

login = "patakraouzeck@gmail.com"
passwd = "tartempionisthebest"
useragent = "Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

import spynner

def displayCurrentUri():
    return browser.webpage.mainFrame().url().toString()


browser = spynner.Browser(
        #debug_level=spynner.WARNING,
        debug_level=spynner.ERROR,
        #debug_level=spynner.DEBUG,
        #debug_level=spynner.INFO,

        user_agent = useragent
)

browser.create_webview(True)
browser.hide()

browser.load("http://television.telerama.fr/tele/grille.php")
browser.wk_fill("input[name=email]", login)
browser.wk_fill("input[name=password]", passwd)
browser.click("input[name=go-ident]")
browser.wait_load()

JS_str = (
        """
// VARIABLES PARAMETRABLES
var bgcol = 'black';    // optionnel : couleur du fond compatible avec les CSS

// BODY CONTENT
document.getElementsByClassName("megabanner-top")[0].innerHTML = "";
document.getElementById("listeurl").parentNode.removeChild(document.getElementById("listeurl"));
document.getElementById("barre-ident").parentNode.removeChild(document.getElementById("barre-ident"));
document.getElementById("barre-nav").parentNode.removeChild(document.getElementById("barre-nav"));
document.getElementById("bottom1").parentNode.removeChild(document.getElementById("bottom1"));
document.getElementById("bottom2").parentNode.removeChild(document.getElementById("bottom2"));
document.getElementById("fil").parentNode.removeChild(document.getElementById("fil"));
document.getElementById("mentions-2008").parentNode.removeChild(document.getElementById("mentions-2008"));
document.getElementById("contenu_pied_de_page_fixe").innerHTML=" ";

// CSS CONTENT
document.body.style.setProperty('background-color', bgcol, null);
document.body.style.backgroundImage="none"; 
document.getElementById("ventre").style.setProperty('padding-top', '0px', null);
document.getElementById("ventre").style.setProperty('padding-bottom', '0px', null);
document.getElementById("gene").style.setProperty('margin', '0%', null);
document.getElementById("gene").style.setProperty('background-color', "white", null);
document.getElementById("sur-gene").style.setProperty('width', '1000px', null);
document.getElementById("contenu_pied_de_page_fixe").style.setProperty('height', '0px', null);

// TRANCHE HORAIRE
changerMaintenant(0);
        """
        )

browser.webview.setGeometry(0,0,1440,1800) # x, y, w, h -> http://doc.qt.nokia.com/stable/application-windows.html#window-geometry
browser.webview.resize(1440,1800) # w, h
browser.show()

browser.runjs(JS_str)
browser.wait_load()
#browser.close()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top