Python Forum
set font from dialog box pyside python
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set font from dialog box pyside python
#1
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
Reply


Messages In This Thread
set font from dialog box pyside python - by Gigux - Apr-24-2017, 08:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PySide / PyQt] Offset two images with keyboard increments carecavoador 1 1,027 Sep-09-2023, 12:53 PM
Last Post: deanhystad
Question Rows and colums list. PySide 6 britesc 2 949 May-31-2023, 09:00 PM
Last Post: deanhystad
  How a QMainWindow can open a dialog? panoss 4 3,628 Feb-03-2022, 04:33 PM
Last Post: panoss
  [Tkinter] question for a tkinter dialog box RobertAlvarez424 2 2,286 Aug-25-2021, 03:08 PM
Last Post: RobertAlvarez424
  [Tkinter] cancelling open dialog gives empty string rwahdan 2 3,426 Jul-17-2021, 09:17 PM
Last Post: steve_shambles
  Drawing in PySide Leo_Red 3 2,861 Jun-26-2021, 09:30 AM
Last Post: Axel_Erfurt
  [WxPython] Return code when closing the dialog ioprst 1 3,221 Aug-13-2019, 11:47 AM
Last Post: jefsummers
  PyQT5 : Unable to Create Another Dialog While One is Open iMuny 3 3,960 Jul-17-2019, 11:40 AM
Last Post: iMuny
  [WxPython] Any dialog that allow user to select file OR folder? buran 3 4,281 Apr-03-2019, 06:33 PM
Last Post: Yoriz
  How to in PySide/PyQt, zooming in and out UI Vladlen 0 2,940 Feb-13-2019, 02:11 PM
Last Post: Vladlen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020