Import tkinter #73674

Closed
opened 2020-02-08 11:47:26 +01:00 by Pete · 10 comments

Import tkinter Module not found error

System Information
Operating system: Windows 10
Graphics card: GTX 1060 6GB

Blender Version
Broken: 2.81a Windows Python version 3.7.4 (default, Aug 13 2019, 14:10:15) [MSC v.1916 64 bit (AMD64)]
Worked: 2.81a OSX Command line outside of blender console (Python Version 3.7.4 inside blender but Python 3.7.1 outside blender console Working

Error can be recreated by one of the following steps

  • from blender import sphere
  • Running the a script from command line blender -b -P test.py --

test.py (Script)

import bpy
from blender import sphere
from blender.utils import hex2rgb, deg2rad, random_like_color
# **Import tkinter Module not found error** **System Information** Operating system: Windows 10 Graphics card: GTX 1060 6GB **Blender Version** Broken: 2.81a Windows Python version 3.7.4 (default, Aug 13 2019, 14:10:15) [MSC v.1916 64 bit (AMD64)] Worked: 2.81a OSX Command line outside of blender console (Python Version 3.7.4 inside blender but Python 3.7.1 outside blender console **Working** **Error can be recreated by one of the following steps** - `from blender import sphere` - Running the a script from command line `blender -b -P test.py --` **test.py (Script)** ``` import bpy from blender import sphere from blender.utils import hex2rgb, deg2rad, random_like_color ```
Author

Added subscriber: @Gadgeteering

Added subscriber: @Gadgeteering

Added subscriber: @rjg

Added subscriber: @rjg

The python.cmake for Windows explicitly excludes tkinter through set IncludeTkinter=false.

The [python.cmake ](https://developer.blender.org/diffusion/B/browse/master/build_files/build_environment/cmake/python.cmake$45) for Windows explicitly excludes `tkinter` through `set IncludeTkinter=false`.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Campbell Barton self-assigned this 2020-02-10 08:38:20 +01:00

This has been intentionally removed.

Closing.

This has been intentionally removed. Closing.
Author

That’s a bit disappointing I will have to find a work around with the script

That’s a bit disappointing I will have to find a work around with the script

This has been intentionally removed.

Closing.

Is it to encourage people to use bpy and Blender native interfaces ? or some other technical reason ?

(I'm running into the same limitation and would like some closure on the idea)

> This has been intentionally removed. > > Closing. Is it to encourage people to use bpy and Blender native interfaces ? or some other technical reason ? (I'm running into the same limitation and would like some closure on the idea)

@TonyG as far as I'm aware tkinter GUI's aren't compatible with Blender's main loop, as in - it's not practical to use tkinter unless Blender is locked (does not refresh), the tkinter GUI can be interacted with, then it can be exited and return to Blender's main loop.
Since this is quite limiting and Blender has it's own GUI, it seems like bundling tkinter is of limited use and certainly won't integrate well with Blender interfaces.

One other down side is tkinter doesn't support Wayland. While this alone isn't a deciding factor, it's a down side if add-ons depend on libraries that aren't supported on all platforms.

@TonyG as far as I'm aware `tkinter` GUI's aren't compatible with Blender's main loop, as in - it's not practical to use `tkinter` unless Blender is locked (does not refresh), the `tkinter` GUI can be interacted with, then it can be exited and return to Blender's `main` loop. Since this is quite limiting and Blender has it's own GUI, it seems like bundling `tkinter` is of limited use and certainly won't integrate well with Blender interfaces. One other down side is `tkinter` doesn't support Wayland. While this alone isn't a deciding factor, it's a down side if add-ons depend on libraries that aren't supported on all platforms.

@ideasman42 Thanks for taking time to clear that out, it makes sense.

You are correct about the use case : my add-on already uses Matplotlib which also freezes Blender while its window is open, tkinter would be no different.
That's ok for me though because I'm presenting data to the user for validation = no need to interact with Blender at the same time.
I'll figure something else ^^

@ideasman42 Thanks for taking time to clear that out, it makes sense. You are correct about the use case : my add-on already uses Matplotlib which also freezes Blender while its window is open, tkinter would be no different. That's ok for me though because I'm presenting data to the user for validation = no need to interact with Blender at the same time. I'll figure something else ^^
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#73674
No description provided.