title: Automatically copy Tkinter text widget content to clipboard?
body: <p>I have created a program in python using Tkinter that converts normal text, into some fancy text.</p>
  
  <p><img src="https://i.stack.imgur.com/LzOzC.png" alt="screenshot"></p>
  
  <p>I was wondering if it is possible for the output to be automatically copied to the clipboard once the 'Convert' button has been pushed.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#Importing TKinter module
  from tkinter import *
  
  #Setting up the GUI window
  win = Tk()
  win.title("Font Converter")
  win.resizable(0,0)
  
  #Converting
  def replace():
      text = entry.get("1.0",END)
  
      replacements = {
  
          #Upper case letters
          "A": "Ａ",
          "B": "Ｂ",
          "C": "Ｃ",
          "D": "Ｄ",
          "E": "Ｅ",
          "F": "Ｆ",
          "G": "Ｇ",
          "H": "Ｈ",
          "I": "Ｉ",
          "J": "Ｊ",
          "K": "Ｋ",
          "L": "Ｌ",
          "M": "Ｍ",
          "N": "Ｎ",
          "O": "Ｏ",
          "P": "Ｐ",
          "Q": "Ｑ",
          "R": "Ｒ",
          "S": "Ｓ",
          "T": "Ｔ",
          "U": "Ｕ",
          "V": "Ｖ",
          "W": "Ｗ",
          "X": "Ｘ",
          "Y": "Ｙ",
          "Z": "Ｚ",
  
          #Lower case letters
          "a": "ａ",
          "b": "ｂ",
          "c": "ｃ",
          "d": "ｄ",
          "e": "ｅ",
          "f": "ｆ",
          "g": "ｇ",
          "h": "ｈ",
          "i": "ｉ",
          "j": "ｊ",
          "k": "ｋ",
          "l": "ｌ",
          "m": "ｍ",
          "n": "ｎ",
          "o": "ｏ",
          "p": "ｐ",
          "q": "ｑ",
          "r": "ｒ",
          "s": "ｓ",
          "t": "ｔ",
          "u": "ｕ",
          "v": "ｖ",
          "w": "ｗ",
          "x": "ｘ",
          "y": "ｙ",
          "z": "ｚ",
  
          #Numbers
          "1": "１",
          "2": "２",
          "3": "３",
          "4": "４",
          "5": "５",
          "6": "６",
          "7": "７",
          "8": "８",
          "9": "９",
          "0": "０",
  
      }
      text = "".join([replacements.get(c, c) for c in text])
      output.delete('1.0', END)
      output.insert(END, str(text))
  
  #Text Variables
  enter = StringVar()
  
  #Creating the widgets
  l1 = Label(win, text="Enter text:")
  entry = Text(win, width=50, height=3, wrap=WORD)
  button = Button(win, text="Convert", width=20)
  l2 = Label(win, text="Converted text:")
  output = Text(win, width=50, height=3, wrap=WORD)
  
  #Positioning the widgets
  l1.grid(row=1, column=1, padx=5, sticky=W)
  entry.grid(row=2, column=1, columnspan=2, padx=5, pady=(0,10))
  button.grid(row=3, column=1, columnspan=2, pady=5)
  l2.grid(row=4, column=1, padx=5, sticky=W)
  output.grid(row=5, column=1, columnspan=2, padx=5, pady=(0,10))
  
  #Button activation
  button.configure(command=replace)
  
  #So the program is on repeat
  win.mainloop()
  </code></pre>
  
  <p>Please excuse the massive inefficiency, I'm still quite a noob when it comes to python. </p>