Tkinter can be used in dynamo

I had a question if tkinter can be used in dynamo?

Likely, but you may have to use the Python 3 engine instead of the Python 2 one.

I am trying to import the library but it does not work, can you tell me that I am doing wrong?

image

# Load the Python Standard and DesignScript Libraries
import sys
import clr
import System

sys.path.append('C:\Users\DCris\AppData\Local\Programs\Python\Python310\lib')

clr.AddReference('tkinter')
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
clr.AddReference('System')

from tkinter import*
import tkinter as tk

ventana = tk.Tk('600x400')
ventana.geometry('Nueva Ventana')
ventana.mainloop()

Interface Tcl/Tk is not implemented in this Dynamo Python engine, you can try to use WinForm(data-shapes UI package) or WPF(xaml) to do that.
I recommend you should see this link : Chapter 9. WPF and IronPython · IronPython in Action

4 Likes

@Christhian
in addition to the remarks of @chuongpqvn , you add to the sys.path a Python 3.10 installation directory, Cpython3 in Dynamo engine use Python 3.8.x 64bits you risk having incompatibilities with import libraries

4 Likes

Excellent thank you very much for the answers