0

I have some problems with tkinter and grid. Help writes that i can use in=master option, but when I try, I get a message invalid syntax. Here is my code:

from tkinter import *
root=Tk()
root.title("Gallery")
text=Text(root)
text.grid(in=master)
root.mainloop()

Can anyone explain to me what the problem is?

asked Jan 4, 2019 at 22:23
3
  • in is a reserved keyword in Python, so this cannot work... where did you read that? Commented Jan 4, 2019 at 22:29
  • Out of curiosity, what do you mean by "help"? Are you referring to the output of help(root) or maybe help(text.grid)? Commented Jan 4, 2019 at 22:44
  • @BryanOakley I meant help(Text(Tk()).grid) Commented Jan 5, 2019 at 0:40

1 Answer 1

2

From the documentation, it states you need to use in_, as in is a reserved word in python--that's why you are getting your syntax error because in isn't being treated as a keyword.

Note that in is a reserved word in Python. To use it as a keyword option, append an underscore (in_).

Also, you don't have master defined anywhere in your code. Perhaps you meant root?

answered Jan 4, 2019 at 22:29
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.