8000 Document that `%gui qt` currently forces Qt5 · Issue #14038 · ipython/ipython · GitHub
[go: up one dir, main page]

Skip to content
Document that %gui qt currently forces Qt5 #14038
@kwsp

Description

@kwsp

Currently, when users select qt with %gui qt or %matplotlib qt, IPython forces matplotlib to switch to Qt5Agg first, before matplotlib's qt_compat.py kicks in (which, if run on its own, can actually pick up the right Qt bindings installed).

"qt": "Qt5Agg",

def find_gui_and_backend(gui=None, gui_select=None):
"""Given a gui string return the gui and mpl backend.
Parameters
----------
gui : str
Can be one of ('tk','gtk','wx','qt','qt4','inline','agg').
gui_select : str
Can be one of ('tk','gtk','wx','qt','qt4','inline').
This is any gui already selected by the shell.
Returns
-------
A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',
'WXAgg','Qt4Agg','module://matplotlib_inline.backend_inline','agg').
"""
import matplotlib
if gui and gui != 'auto':
# select backend based on requested gui
backend = backends[gui]

This isn't documented and has caused me a lot of confusion and trouble (and will cause further trouble in the future as usage of Qt6 increases over Qt5):

I found out about this after spending months trying to work out why %matplotlib qt doesn't work when I have Qt6 bindings installed: matplotlib/matplotlib#25673 (comment)

I suggest we either explicitly document this in the IPython line magic docs, or we change this default behavior.

Relevant but not duplicate:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0