title: Is it possible for a variable to recognise that its is holding a dictionary variable and use it accordignly
body: <p>Im making a simple game with tkinter in python 3 that includes a function I made that goes through a dictionary of sections of text everytime I click a button.</p>
  
  <pre><code>new_pokemon_dictionary = {
  "1": "It's a new pokemon!", "2": "Are you ready to fight it?"#, "3": "3rd piece of text etc
  }
  text_scroll_n=0
  def next_button():
      global text_scroll_n
  
      textbox.delete(0.0, END)
      text_scroll_n+=1  #Every time next_button run adds 1, this makes it print new part of the dictionary            
  
      if game_stage == 1:
          text_scroll("new_pokemon_dictionary")
      else:
          return
      textbox.insert(END, text_output)
      screen.update()
  </code></pre>
  
  <p>By clicking the next button <code>text_scroll_n</code> is increased by one and is used by the <code>text_scroll</code> function to choose a new part of the dictionary to display:</p>
  
  <pre><code>def text_scroll(dictionary):
  
      if text_scroll_n&lt;=len(dictionary):
          print(dictionary)
          text_output = dictionary[str(text_scroll_n)] #Textbox will insert at end of next_button function
      else:
          game_stage +=1 
  </code></pre>
  
  <p>However when running this, (and other parts of code such as creating the texbox not shown), I'm given the error: <code>TypeError: string indices must be integers</code> . <br /><br /> I'm assuming this is because it is trying to set <code>text_output</code> to a letter in <code>dictionary</code>, whose position in the word equals the integer that text_scroll_n is.
  <br /><br />However when I replace the line <code>text_output = dictionary[str(text_scroll_n)]</code> in the <code>text_scroll</code> function with <code>text_output = new_pokemon_dictionary[str(text_scroll_n)</code> it works perfectly, recognising that the new_pokemon_dictrionary variable is a dictionary.<br /><br /></p>
  
  <p>Is there anyway I can use the <code>text_scroll(dictionary)</code> throughout my code, just putting in the different dictionary variable names that I want to use as the paramater, or is the only fix to rewrite the needed code for all of the different dictionaries?</p>
  
  <p>Im new to coding so sorry if any of this is sloppy.<br />
  Thanks!</p>