Re: QScintilla problems.
Colin McPhail <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <AM0PR0602MB3347B752543EC62F61A08A1D85AB0@AM0PR0602MB3347.eurprd06.prod.outlook.com> |
> On 18 Aug 2019, at 19:30, Barry Scott <[email protected]> wrote: > > > > The attached code shows two problems with QScintilla. > > 1. SCI_STYLEGETFONT does not return the font. > 2. Changing the size to 24pt makes line spacing be 24pt but the text is drawn in 11pt. > > (1) looks likes a bug. > (2) may be that I do not understand something about how to drive the API. > What makes Scintilla use the changed settings. > > (3) Changing the font does not seem to work either. > > What am I misunderstanding? > > Barry I'm not a QScintilla expert but I imagine most people use the convenience methods of QScintilla objects such as setFont() and setText(). I've attached a version of your example code that uses those methods. Coiin _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
qsci_bug_2.py
(text/x-python-script, 923 B)
#!/usr/bin/env python
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QFont
from PyQt5 import Qsci
class HelloWindow(QMainWindow):
def __init__( self ):
super().__init__()
py_ver = '%d.%d' % (sys.version_info.major, sys.version_info.minor)
self.setMinimumSize( QSize(350, 100) )
self.setWindowTitle( 'GUI test - python %s' % (py_ver,) )
self.scin = Qsci.QsciScintilla( self )
self.scin.setUtf8(True)
t = '''Example text line 1.
And this is line 2
'''
self.setCentralWidget( self.scin )
self.scin.setFont(QFont('Courier New', 24))
self.scin.setText(t)
if __name__ == "__main__":
app = QApplication( sys.argv )
main_win = HelloWindow()
main_win.show()
sys.exit( app.exec_() )