(PyQt) Why can't I change the font of my QTextEdit widget?
<p>Whenever I try to change the font of my QTextEdit widget using the function from the last codeblock, the program crashes instantly with code 1. What could be the reason of it?</p>

<pre><code>self.font = QFont("Arial")
</code></pre>

<p>...</p>

<pre><code>self.text_edit = QTextEdit()
self.setCentralWidget(self.text_edit)
self.text_edit.setCurrentFont(self.font)      
</code></pre>

<p>...</p>

<pre><code>def aFont(self):
    previous_font = self.font
    self.font = QFontDialog().getFont(previous_font)
    if self.font != previous_font:
        self.text_edit.selectAll()
        self.text_edit.setCurrentFont(self.font)
</code></pre>