Home > front end >  Issue with tkinter being unable to open a window (Python tkinter module)
Issue with tkinter being unable to open a window (Python tkinter module)

Time:04-24

I don't understand what the problem is with my code - it has everything i need and should execute fine.

No error is generated so I believe it is a logic error but I don't know how to fix it per say.

Help with this would be much appreciated.

from tkinter import *
from tkinter import ttk

def Payment_Computation(self):

 
def Getting_Payment_in_Monthly():


def __init__(self):

CodePudding user response:

You are missing some vital parts of an oop program:

from tkinter import *
from tkinter import ttk

class MainApplication():   # create class

    def __init__(self):
        # method code

    def Payment_Computation(self):
        # method code
     
    def Getting_Payment_in_Monthly(self, Amount_Loan, mon_rate_interest, no_of_yrs):
        # method code

if __name__ == "__main__":
    MainApplication()    # Instantiate class

You need to place the code in a class. You then need to instantiate the class as exemplified above.

Read more about oop program structure in Best way to structure a tkinter application?

CodePudding user response:

You didn't call the __init__() function. Please check carefully :)

  • Related