Using Modules unavailable in Rhino8 Python editor

Hi All,

May I ask how do you import a module that’s currently unavailable?
Is it possible to do pip install in Rhino Python Editor?

The module I would like to use is Tkinter

You can use # r: modulename after the line with #! python3 to install other modules.

tkinter should work on at least Windows. For Mac there is this YT item: RH-67505 Implement support for tkinter, turtle on macOS

A topic from earlier this year: Loading Tkinter in Python for Rhino 8 - #2 by scottd

1 Like

Hi Nathan,
Thank you so much for the fast response!

May I ask you to clarify if the following script looks correct to you?
I am still getting the"" Message: No module named tkinter""
Does it have anything to do with my Python setting?

#! python3
# r: tkinter

import rhinoscriptsyntax as rs
import scriptcontext as sc
import math

import System
import System.Collections.Generic
import Rhino

import tkinter

tkinter._test()

Some other information:

print(sys.version)

returns [.NETCoreApp,Version=v3.1 on .NET 7.0.20 (64-bit)]
I guess this means it is running ironpython

Is there a way for me a explicitly enable Cpython on my machine?
I have Rhino8 SR13

Make sure you are using _ScriptEditor to start the script editor, and that you select python 3 when adding a new script.

2 Likes

amazing. everything works! thanks again

1 Like