set font from dialog box pyside python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: set font from dialog box pyside python (/thread-3019.html) |
set font from dialog box pyside python - Gigux - Apr-24-2017 i am setting a simple text editor and one of its item is the capability of formatting the font. i am using a dialog box to chose the font and giving a default value; i am using QFont to set the default. I would like to set the default to 'consolas' or 'liberation mono'; i found the former to be easier to implement. however when i launch the window, the default font is not 'consolas'. how shall i set the code for QFont in order to get 'consolas' or 'liberation mono' regular? this is the code i wrote: def fontChange(self): (font, ok) = QFontDialog.getFont(QFont("Consolas", 11), self) if ok: self.textEdit.setCurrentFont(font)thanks RE: set font from dialog box pyside python - Joseph_f2 - May-08-2017 Your question is clear, however, I would like to know exactly what packages you're using? Would it be possible to supply your source code, or at least some keys parts of it and your imports? |