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
#2
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PySide / PyQt] Offset two images with keyboard increments carecavoador 1 953 Sep-09-2023, 12:53 PM
Last Post: deanhystad
Question Rows and colums list. PySide 6 britesc 2 868 May-31-2023, 09:00 PM
Last Post: deanhystad
  Is there is a printer dialog box in PySimpleGUI shaunfish 2 1,582 Aug-22-2022, 07:29 PM
Last Post: deanhystad
  How a QMainWindow can open a dialog? panoss 4 3,473 Feb-03-2022, 04:33 PM
Last Post: panoss
  [Tkinter] question for a tkinter dialog box RobertAlvarez424 2 2,205 Aug-25-2021, 03:08 PM
Last Post: RobertAlvarez424
  [Tkinter] cancelling open dialog gives empty string rwahdan 2 3,308 Jul-17-2021, 09:17 PM
Last Post: steve_shambles
  Drawing in PySide Leo_Red 3 2,747 Jun-26-2021, 09:30 AM
Last Post: Axel_Erfurt
  [WxPython] Return code when closing the dialog ioprst 1 3,154 Aug-13-2019, 11:47 AM
Last Post: jefsummers
  PyQT5 : Unable to Create Another Dialog While One is Open iMuny 3 3,817 Jul-17-2019, 11:40 AM
Last Post: iMuny
  [WxPython] Any dialog that allow user to select file OR folder? buran 3 4,179 Apr-03-2019, 06:33 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

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