tkinter sticky=N+W Error: global name 'N' is not defined tkinter sticky=N+W Error: global name 'N' is not defined tkinter tkinter

tkinter sticky=N+W Error: global name 'N' is not defined


As the error mentions, the problem is that you are referencing a variable N (as well as W) which are not defined.

These are variables defined in Tkinter, so you could do tk.N and tk.W, or alternatively just use the strings that those variables define, e.g.:

 self.inputLabel.grid(row = 1, column = 0, columnspan = 2, padx = 5, pady = 10, sticky = 'nw')

There are a couple of other issues that were preventing the code from running. You were creating a separate member Frame inside your QueryInterface which already inherits from Frame, and packing that.

This code runs.

import Tkinter as tkclass QueryInterface(tk.Frame):  def __init__(self, master):    tk.Frame.__init__(self, master)    self.master.geometry("400x300+400+200")    self.master.title("Thug Client-Side Honeypot")    self.master.resizable(width = False, height = False)    self.inputLabel = tk.Label(self, text = "Input arguments and URL:", font = "Calibri 11")    self.inputLabel.grid(row = 1, column = 0, columnspan = 2, padx = 5, pady = 10, sticky = 'nw')    self.pack()def main():  root = tk.Tk()  app = QueryInterface(root)  app.mainloop()if __name__ == '__main__':  main()