0

I have created two Tkinter GUI files and I want to open the second file with the first one by the click of a button. I have made a function which just imports the second file but it is not working. Here's the code:

def receiver_func():

    exec(open('receiver.py').read()) #None of them is working and raising error
    import receiver 

meanwhile, if I open both files individually, they run fine and smooth!

Here's the error log:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\PAKLAP.pk\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "D:/Programming Projects/Investors Foundation/main.py", line 16, in receiver_func
    exec(open('receiver.py').read())
  File "<string>", line 26, in <module>
  File "C:\Users\PAKLAP.pk\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 2766, in __init__
    Widget.__init__(self, master, 'label', cnf, kw)
  File "C:\Users\PAKLAP.pk\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 2299, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "pyimage3" doesn't exist
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685

0 Answers0