Hi all,
Is this supposed to work in PyRevit / IronPython Shell..?
from Tkinter import *from Tkinter import *
import Tkinter, Tkconstants, tkFileDialog
root = Tk()
root.filename = tkFileDialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("jpeg files","*.jpg"),("all files","*.*")))
print (root.filename)
I am getting Error message " No module named Tkinter"
I tried tkinter as well. but same result.
I can see tkinter folders inside Python27 Libs & DLLs.
Is there something I have to install..?
Please advise.
Thanks in advance.
Nah. TKinter have not been implemented in IronPython. You have a much better platform available for GUI interfaces. Look into Windows Presentation Foundation (WPF) and IronPython.Wpf
There are plenty of examples in both pyRevit tools and revitpythonwrapper (rpw)
I'm not sure if tkinter works with ironpython.
Seems like it might not:
https://stackoverflow.com/questions/27785815/install-tkinter-on-ironpython
Now the good news. Ironpython plays really nicely with wpf and other windows forms, which just as easy and perhaps even easier than tkinter.
PyRevit also ships with rpw, which already has some windows dialogs and wpf forms built in.
open file dialog for example is a one liner:
>>> from rpw.ui.forms import select_file
>>> filepath = select_file('Revit File ('*.rvt)|*.rvt')
'C:\folder\file.rvt'
http://revitpythonwrapper.readthedocs.io/en/latest/ui/forms.html#select-file
Thanks @eirannejad & @gtalarico ,
I have trouble with rpw.
from rpw ...returns a big error message. That why I thought, I will try Tkinter. Don't know what is problem with rpw.
Tried on machine with Pyrevit & without. Same result. And when I tried to install Pyrevit, install hangs during cloning.
Any clues..
Traceback (most recent call last):
File "
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw__init__.py", line 36, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\db__init__.py", line 19, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\db\view.py", line 10, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\db\collector.py", line 35, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\ui__init__.py", line 1, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\ui\forms__init__.py", line 12, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\ui\forms\flexform.py", line 6, in
File "F:\Revit Stuffs\Revit Pyhon Wrapper\revitpythonwrapper-master\rpw\ui\forms\resources.py", line 46, in
IOError: System.IO.IOException: Could not add reference to assembly IronPython.Wpf
Hi all,
After re-installing RPS & Pyrevit & adding below path on RPS search path, it works good.
C:\Program Files (x86)\IronPython 2.7\Platforms\Net40
And I got the select_file working...
Thanks
Most helpful comment
I'm not sure if tkinter works with ironpython.
Seems like it might not:
https://stackoverflow.com/questions/27785815/install-tkinter-on-ironpython
Now the good news. Ironpython plays really nicely with wpf and other windows forms, which just as easy and perhaps even easier than tkinter.
PyRevit also ships with rpw, which already has some windows dialogs and wpf forms built in.
open file dialog for example is a one liner:
http://revitpythonwrapper.readthedocs.io/en/latest/ui/forms.html#select-file