My code:

Code:
from tkinter import *
from googlesearch import search

def search_input():
    global e
    global j
    search1 = e.get()
    try:
        from googlesearch import search
    except ImportError:
        print("No module named google")
    for j in search(search1, tld="co.in", num=10, stop=10, pause=2):
        results()

def results():
    results1 = Label(text = j)
    results1.pack()

               
main_screen = Tk()
main_screen.geometry("700x250")
main_screen.title("Inphorium")

e = Entry(main_screen, width=40, borderwidth=5)
e.grid(row=3, column=4, columnspan=3, padx=10, pady=10)
submit = Button(main_screen, text = "Search", width = 5, command = search_input)
submit.grid(row=3, column = 8)

spacer = Label(main_screen, text = "                 ")
spacer.grid(row = 3, column = 0)
spacer = Label(main_screen, text = "                 ")
spacer.grid(row = 3, column = 1)
spacer = Label(main_screen, text = "                 ")
spacer.grid(row = 3, column = 2)
spacer = Label(main_screen, text = "                 ")
spacer.grid(row = 3, column = 3)
spacer = Label(main_screen, text = "  ")
spacer.grid(row=0,column=0)
spacer = Label(main_screen, text = " ")
spacer.grid(row=1,column=0)



I am trying to make a google interpreter but this error shows up:

>>> Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\warth\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1885, in __call__
return self.func(*args)
File "C:\Users\warth\AppData\Local\Programs\Python\Python39\Emphorium_main.py", line 13, in search_input
results()
File "C:\Users\warth\AppData\Local\Programs\Python\Python39\Emphorium_main.py", line 17, in results
results1.pack()
File "C:\Users\warth\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2389, in pack_configure
self.tk.call(
_tkinter.TclError: cannot use geometry manager pack inside . which already has slaves managed by grid
I'm unfamiliar with tk, but the error seems clear enough to me. You're using grid layout for most of the window, and it tells you that it's not permitted to mix grid and pack layout methods.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement