Re: [PyQt] Fonts on Macbook

2010-02-13 Thread Colin McPhail

On 13 Feb 2010, at 20:17, David Arnold wrote:

> 
> No matter what changes I make to this line:
> 
>QtGui.QToolTip.setFont(QtGui.QFont('Arial', 20))
> 
> The results are always the same. Are there any Mac users out there who can 
> actually change fonts and fontsize in this script?
> 
I confirm that this does not seem to have any effect on Mac.  However, you can 
change the appearance of tooltips by using a stylesheet:

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore

class Tooltip(QtGui.QWidget):
   def __init__(self, parent=None):
   QtGui.QWidget.__init__(self, parent)

   self.setGeometry(300, 300, 250, 150)
   self.setWindowTitle('Tooltip')

   tip_style = """
QToolTip {
 border: 2px solid green;
 border-radius: 4px;
 padding: 2px;
 font-family: "Arial";
 font-size: 20pt;
 }
 """
   self.setStyleSheet(tip_style)

   self.setToolTip('This is a QWidget widget')


app=QtGui.QApplication(sys.argv)
tp=Tooltip()
tp.show()
sys.exit(app.exec_())

If you want all tooltips to have the same non-default appearance then I think 
that you could use QApplication's setStyleSheet method instead of QWidget's one.

-- CMcP

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Fonts on Macbook

2010-02-13 Thread David Arnold
All,

I am trying a zetcode tutorial file:

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore

class Tooltip(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)

self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Tooltip')

self.setToolTip('This is a QWidget widget')
QtGui.QToolTip.setFont(QtGui.QFont('Arial', 20))


app=QtGui.QApplication(sys.argv)
tp=Tooltip()
tp.show()
sys.exit(app.exec_())


No matter what changes I make to this line:

QtGui.QToolTip.setFont(QtGui.QFont('Arial', 20))

The results are always the same. Are there any Mac users out there who can 
actually change fonts and fontsize in this script?

David


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt