I am trying to print a dictionary to screen, however, prior to its creation I want it to display nothing ("").
def dictionarysubmit():
Letter = entry2.get()
Rule = entry3.get()
global grammar
grammar = {}
grammar[Letter] = Rule
## print (grammar)
This is the creation of the dictionary, however is only prompt on button click.
I am currently trying:
cr = {}
if grammar in globals:
cr = grammar
else:
cr = {}
NameError: name 'grammar' is not defined
Is the error I am getting, I understand that grammar is not defined upon execution of the programme.