1

Widgets works generally when running this when code below

Label(window, image=photo1, bg="black").grid(row=0, column=0, sticky=E)

Code gives me the error:

_tkinter.TclError: cannot use geometry manager grid inside . which already has slaves managed by pack

I understand that this error is about using both .pack and .grid but it works without this line, which also utilises .pack and .grid together

def widgets(self):
        self.head = Label(self.master,text=" Welcome to Luxury Cruises ", font=('freesansbold', 25),pady=40)
        self.head.pack()

        self.logf = Frame(self.master, padx=10, pady=10)
        Label(self.logf, text="Username: ", font=('freesansbold', 20), padx=5, pady=10).grid(sticky=W)
        Entry(self.logf, textvariable=self.username, bd=8, font=('calibri', 15, 'bold')).grid(row=0, column=1, sticky=E)
        Label(self.logf, text="Password: ", font=('freesansbold', 20), padx=5, pady=10).grid(row=1, column=0, sticky=W)
        Entry(self.logf, textvariable=self.password, bd=8, font=('calibri', 15, 'bold'), show="*").grid(row=1, column=1,
                                                                                               sticky=E)
        Button(self.logf, text=" Login ", bd=7, font=("monaco", 15, 'bold'), padx=5, pady=5, command=self.login).grid(
            row=2)
        Button(self.logf, text=" Make Account ", bd=7, font=("monaco", 15, 'bold'), padx=5, pady=5,
               command=self.cr).grid(row=2, column=1)
        self.logf.pack()
j_4321
  • 15,431
  • 3
  • 34
  • 61
nickylake
  • 11
  • 2
  • 2
    What you said pack() and grid() together works because they are used in different containers. – acw1668 Feb 27 '20 at 00:52

1 Answers1

0

When you are using the .pack() function, you cannot use the .grid() function.

check out When to use pack or grid layouts in tkinter?

Nathan
  • 44
  • 1
  • 8
  • 2
    Not strictly correct. You cannot use the 2 in the same container. But you can say for example pack a frame and then grid everything in that frame. Also `pack` and `grid` are methods not functions. – Mike - SMT Mar 04 '20 at 03:48