Home > Net >  "cannot import name 'geometry' from 'tkinter'"
"cannot import name 'geometry' from 'tkinter'"

Time:12-29

I am trying a "Hello World" test on a GUI window, imported from tkinter. The problem starts when I try to run it and an error pops up in the terminal of VScode: cannot import name 'geometry' from 'tkinter'.

import csv
from fileinput import filename
import os
from tkinter import *
from tkinter import ttk
from tkinter import Tk, Button, Frame, Entry, END
from tkinter import geometry

class attendance_tester(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()   
root = Tk()     
root.geometry("800x800")
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
app = attendance_tester(master=root)
app.master.title("Student Attendance Program")
app.mainloop()
root.destroy()


from attendance_create import (func_create, func_edit_add,
                               func_ask_edit, func_edit_change, func_edit_sub,
                               func_edit_view, func_open, func_first_change)

with open(r"C:\\Users\\user_name\\Desktop\\attendance_sheet.csv") as file:
    csv_file_read = csv.reader(file)
    for row in csv_file_read:
        print(row)
func_open()
attend_test = attendance_tester(root)
root.mainloop()

I have tried seemingly every solution I could find on the internet. I really need some help.

CodePudding user response:

You don't need to import geometry to use it. Just remove the import line and it should work.

CodePudding user response:

you shouldnt import it from the first place you just need to import the tkinter itself just remove that line and it should be just fine

  • Related