asweigart / PyMsgBox

Simple, cross-platform, pure Python module to display message boxes, and just message boxes.
BSD 3-Clause "New" or "Revised" License
59 stars 18 forks source link

'Tkinter is required for pymsgbox' #2

Closed ghost closed 7 years ago

ghost commented 7 years ago

I am using python 3+ and get the following exception:

File "/usr/local/lib/python3.5/dist-packages/pymsgbox/__init__.py", line 105, in confirm                                                                                                    
    assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox'                                                                                                                       
AssertionError: Tkinter is required for pymsgbox

when I try to use a native pymsgbox confirm dialog on debian with vs code:

import pymsgbox.native as pymsgbox 
resp = pymsgbox.confirm(text='Do you want to overwrite the current projects?',
  title='Overwrite projects?', buttons=['Yes', 'Cancel'])

I thought Tkinter is built in python 3+? Can anyone help me please?

ghost commented 7 years ago

Ok seems I needed to install 'python3-tk' package, surprise....

raokiran841 commented 5 years ago

'python3-tk' package is not required for python 3.7. I am using python 3.7 windows system and i am facing this problem when i converted my script to .exe file ... please explain what was the problem and how to resolve it exactly. below is my setup.py file

`import cx_Freeze from cx_Freeze import * import os

os.environ['TCL_LIBRARY'] = r'C:\Users\kiran\AppData\Local\Programs\Python\Python37-32\tcl\tcl8.6' os.environ['TK_LIBRARY'] = r'C:\Users\kiran\AppData\Local\Programs\Python\Python37-32\tcl\tk8.6'

setup(name="TargetApplContactCrossCheck", options = {'build_exe':{'packages':['tkinter','time','os','cx_Oracle','selenium','openpyxl','pymsgbox','configparser','functools','itertools'], "include_files":["Credentials.cfg"]}}, executables = [Executable('TargetApplContactCrossCheck.py',)])`

And then i run this using a bat file.

python setup.py build

Please help me.

jaimesalazarlaherarandstad commented 4 years ago

@raokiran841 Did you ever figure out how to get rid of that error when using cx_freeze?