Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:08:09+00:00 2026-06-14T05:08:09+00:00

I am working on a little programme that will serve as a chemistry calculator

  • 0

I am working on a little programme that will serve as a chemistry calculator or sth like that, and I’ve run into some trouble along the way…

In the main file, I’m trying to import class Aplikacija from file grafika.py, but it doesn’t seem to be working no matter how hard I try – I get the AttributeError: ‘module’ object has no attribute ‘Aplikacija’.

It might be this is a beginner’s problem, but I’ve been staring at the screen for a couple of hours and I have no clue as to what might be wrong. I’d be really grateful if you could help me out 🙂

P.S: please don’t mind the variable’s names as my native language isn’t English…

The (shortened) code of the main file:

import grafika
from Tkinter import *

root = Tk()
root.title('ChemHelp v0.1')
root.minsize(360, 240)
#root.iconbitmap('mojaikona.ico')

p = grafika.Aplikacija(root)

root.mainloop()

And this is the whole grafika.py file (it’s quite long…)

from Tkinter import *
import webbrowser

class Aplikacija():

    def __init__(self, master):

        #meni
        self.meni = Menu(master)
        master.config(menu=self.meni)
        self.meni.add_command(label="Periodni sistem", command=self.ps_okno)

        self.help_meni = Menu(self.meni)
        self.meni.add_cascade(label="Pomoč", menu=self.help_meni)
        self.help_meni.add_command(label="PDF", command=self.open_pdf)
        self.help_meni.add_command(label="Spletna dokumentacija", command=self.open_web)

        self.meni.add_command(label="O programu", command=self.open_about)
        self.meni.add_command(label="Zahvale", command=self.open_thanks)
        self.meni.add_command(label="Zapri", command=quit)

        #glavno okno
        body = Frame(root, width=360, height=240)
        body.pack()

        #izracun molske mase
        self.okno_masa = LabelFrame(body, text="Molska masa", padx=5, pady=5)
        self.okno_masa.grid(padx=10, pady=10)
        self.prompt1 = Label(self.okno_masa, text="Formula spojine: ")
        self.prompt1.grid(row=0, sticky=W)
        self.formula1 = Entry(self.okno_masa)
        self.formula1.grid(row=0, column=1)
        self.send1 = Button(self.okno_masa, text="Pošlji", command=lambda: self.gfx_molska_masa(self.okno_masa))
        self.send1.grid(row=1, columnspan=2)

        #izracun mnozine
        self.okno_mn = LabelFrame(body, text="Množina", padx=5, pady=5)
        self.okno_mn.grid(padx=10, pady=10)
        self.prompt2 = Label(self.okno_mn, text="Formula spojine: ")
        self.prompt2.grid(row=4, sticky=W)
        self.formula2 = Entry(self.okno_mn)
        self.formula2.grid(row=4, column=1)
        self.prompt3 = Label(self.okno_mn, text="Masa spojine: ")
        self.prompt3.grid(row=5, sticky=W)
        self.masa = Entry(self.okno_mn)
        self.masa.grid(row=5, column=1)
        self.send2 = Button(self.okno_mn, text="Pošlji", command=lambda: self.gfx_mnozina(self.okno_mn))
        self.send2.grid(row=6, columnspan=2)

    #funkcije
    def ps_okno(self):
        self.ps = Toplevel()
        self.ps.title("Periodni sistem")
        self.ps.minsize(480, 180)
        self.tekst = Label(self.ps, text="Tukaj bo periodni...")
        self.tekst.grid()
        self.zapri = Button(self.ps, text="Zapri", command=self.ps.destroy)
        self.zapri.grid()
        print("Okno odprto :P")

    def open_pdf(self):
        print("PDF odprt ;)")

    def open_web(self):
        self.url = 'http://test.org'
        webbrowser.open_new(self.url)
        print("Splet prečekiran :D")

    def open_about(self):
        self.o = Toplevel()
        self.o.title("O programu")
        self.o.minsize(300, 300)
        self.about = LabelFrame(self.o, text="O programu", padx=5, pady=5)
        self.about.grid(padx=10, pady=10)
        self.slika = PhotoImage(file="about_slika.gif")
        self.photo = Label(self.about, image=self.slika)
        self.photo.slika=self.slika
        self.photo.grid(row=0, columnspan=2)
        self.avtor = Label(self.about, text="Avtor: ")
        self.avtor.grid(row=1, sticky=W)
        self.avtor2 = Label(self.about, text="Jane Doe")
        self.avtor2.grid(row=1, column=1)
        self.verzija = Label(self.about, text="Verzija programa: ")
        self.verzija.grid(row=2, sticky=W)
        self.verzija2 = Label(self.about, text="1.0")
        self.verzija2.grid(row=2, column=1)
        self.jezik = Label(self.about, text="Pisano v programskem jeziku Python. © 2013")
        self.jezik.grid(row=3, columnspan=2)
        self.zapri = Button(self.about, text="Zapri", command=self.o.destroy)
        self.zapri.grid(row=4, columnspan=2)
        print("Kdo bo to sploh bral? :O")

    def open_thanks(self):
        self.h = Toplevel()
        self.h.title("Zahvale")
        self.h.minsize(200, 200)
        self.zahvale = LabelFrame(self.h, text="Zahvale", width=100, padx=5, pady=5)
        self.zahvale.grid(padx=10, pady=10)
        self.z_vsebina = Label(self.zahvale, text="Rada bi se zahvalila bla bla... in tle pol ful teksta al neki...")
        self.z_vsebina.grid()
        self.mentor = LabelFrame(self.h, text="Mentor", width=100, padx=5, pady=5)
        self.mentor.grid(padx=10, pady=10)
        self.m_vsebina = Label(self.mentor, text="John Does, prof.")
        self.m_vsebina.grid()
        self.viri = LabelFrame(self.h, text="Viri", width=100, padx=5, pady=5)
        self.viri.grid(padx=10, pady=10)
        self.v_vsebina = Label(self.viri, text="http://test.org \nhttp://www.test.com")
        self.v_vsebina.grid()
        self.zapri = Button(self.h, text="Zapri", command=self.h.destroy)
        self.zapri.grid()
        print("Tale stvar je lame -.-")

    def gfx_molska_masa(self, frame):
        self.rezultat = Entry(frame)
        self.rezultat.config(width="9")
        self.rezultat.grid(row=3)
        self.molska_masa = "187"
        self.rezultat.insert(0, self.molska_masa)
        self.enota = Label(frame, text="g/mol")
        self.enota.grid(row=3, column=1, sticky=W)
        print("Molska masa je")

    def gfx_mnozina(self, frame):
        self.rezultat = Entry(frame)
        self.rezultat.config(width="8")
        self.rezultat.grid(row=7)
        self.mnozina = "1.0"
        self.rezultat.insert(0, self.mnozina)
        self.enota = Label(frame, text="mol")
        self.enota.grid(row=7, column=1, sticky=W)
        print("Mnozina je")

When I run the code from the main file in the grafika.py file, it works fine, no errors or anything…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:08:10+00:00Added an answer on June 14, 2026 at 5:08 am

    If you’ve already imported the file once, another import won’t reload it – modules are cached. You need to reload(grafika) to pick up your latest changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a little WPF app that will run fullscreen and I'd like
I'm working on a little Android app to stream some camera footage (as a
I am working on a little card-swapping world-travel game that I sort of envision
I am working on a little mini compiler while trying to learn some MIPS
I'm working on a little program that needs to pipe binary streams very closely
I'm working on a program that will (hopefully) compare all files in a given
I am working on building a little game program like this one for a
I'm currently working on a class that will create an x,y graph according to
I'm currently working on a program in WinForms that will require a lot of
So I have a library I'm working on that has, or will have, optimised

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.