Getting a simple file dialog in abaqus seems pretty difficult, so i wanted to use tkinter. It seems tkinter come with abaqus, but when i try to import the module it says:
File "/opt/Abaqus/6.12-1/tools/SMApy/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
importing _tkinter is also not working. so how can one get tkinter to work in abaqus?
Greetings,
Related
I'm working on creating an interface between tkinter and JSON. I need to look through the code of Tkapp to do so because I need to understand its attributes. Failing that, how can I import it?
from tkinter import _tkinter
from _tkinter import tkapp
Returns an ImportError
_tkinter is a C-based module. tkapp is defined in its source code which you can find here on GitHub.
I'm new to python and programming in general, and I wanted to play around with the turtle module, but when I try to import it (I was told it was part of the python library so I did not need to download it) I get an error telling me that there was no module.
The specific error I get in Visual Studio Code is:
File "turtle.py", line 107, in
ModuleNotFoundError: No module named 'tkinter'
I have tried import turtle, from turtle import * and my python file is not named anything related to the turtle module.
I am new to Python Programming.
I am using tkinter module to import stuff for graphical user interface.
I import everything from the tkinter module by typing the following statement:
from tkinter import *
Why do I still need to import some certain classes separately from the same module like simpledialog although we have imported everything using the above statement from tkinter?
from tkinter import simpledialog
Without importing simpledialog separately, it throws an error.
Yes, it does throw the error because simpledialog is not directly the module of tkinter.
Basically, the module is every file, which has the file extension .py and consists of proper Python code. There is no special syntax required to make such a file a module. A module can contain arbitrary objects, for example files, classes or attributes. All those objects can be accessed after an import.
If you will do dir(tkinter) without importing the simpledialog explicitly, it shows the results except simpledialog in it.
This is because of the library structure. It doesn't import all the modules of tkinter automatically. Once you use import tkinter.simpledialog it will show you the simpledialog module in it, which means simpledialog was never imported from tkinter earlier.
Also, it is recommended to use import tkinter instead of from tkinter import astrik, except when working in the interactive Python shell. One reason is that the origin of a name can be quite obscure, because it can't be seen from which module it might have been imported.
I have been using http://python.codnex.net/index.php. I have tried to use Tkinter but it shows ImportError: No module named Tkinter on line 1
I have tried many things including:
import Tkinter
import tkinter
from tkinter import *
If you find something please let me know.
According to this question & answer in Quora you can't use tkinter with online interpreters. Though apparently you can run linux along chromeOS if you have non-school version.
I might be wrong, but I believe it's because tkinter is a GUI module, which can't be ran from a webbrowser.
Have you tried importing it in a local python instance?
it wont work on web browser ,Run a local python instance and import tkinter after installing tkinter by using command prompt using the command pip install python-tk
I'm having issues running a tkinter program in python 3.5.1, and I really don't understand what's going on. It's never been a problem prior to this point, but now when attempting to run the program in question, I get the following error:
Traceback (most recent call last):
File "C:/Users/Joe/PycharmProjects/Physics2-0/Physics2-0.py", line 1, in <module>
from tkinter import *
File "C:\Python35\lib\tkinter\__init__.py", line 35, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: DLL load failed: The specified module could not be found.
I recently uninstalled and reinstalled python 3.5.1 to make sure that everything was set back to the default way it's supposed to be and was when I started developing the program, because I thought I might have messed something up while trying to work with cx_freeze, and as far as I can tell, everything is as it was before, when the program worked. I have no idea what changed. The import statements for the program in question are below:
from tkinter import *
from tkinter import ttk
from sympy import Symbol
from sympy.solvers import solve
Any and all help is appreciated. I'm at a loss for how to go forward.
EDIT 1: This is getting weirder and weirder. After running the tkinter test like I said in the comments that I did, I tried running the program, and now it will run. I have no clue why.
EDIT 2: The plot thickens. I created a setup.py for cx_freeze to make another attempt at creating an executable of the program. I set my tcl and tk libraries manually as c:\python35\tcl\tcl8.6 and c:\python35\tcl\tk8.6, respectively, and tried to build the executable. It seemed like it worked, but when I ran the executable, it gave me the same error message as it did above, but in a popup error message box, not console. I then tried to do the tkinter test in a python console again, and now when I try import _tkinter I get an error message saying ImportError: DLL load failed: The specified module could not be found. I don't think my computer has ever confused me this much. Someone please help.