module pycode.tkinter_helper

Short summary

module pyquickhelper.pycode.tkinter_helper

Helpers for tkinter

source on GitHub

Functions

function

truncated documentation

fix_tkinter_issues_virtualenv

Fix an issue which happens in a virtual environment, see Fix Tcl inside a virtualenv on Windows

Documentation

Helpers for tkinter

source on GitHub

pyquickhelper.pycode.tkinter_helper.fix_tkinter_issues_virtualenv(exc=True, fLOG=None)[source]

Fix an issue which happens in a virtual environment, see Fix Tcl inside a virtualenv on Windows

Parameters:
  • exc – raise an exception instead of a warning

  • fLOG – logging function

Returns:

list of environment variables

We try to deal with the following issue on Linux:

_tkinter.TclError: no display name and no $DISPLAY

On Linux, the solution is to run:

import matplotlib as mpl
mpl.use('Agg')

But it does not work if matplotlib was already imported. It is recommended to delay its import whenever it is possible.

source on GitHub