title: Copying text in tkinter from label or msgbeox
body: <p>I been searching for methods to copy text to clipboard or copy the results from Tkinter gui but idk if there is a command or something</p>
  <p>here is my code for now here the result comes in a messagebox can i copy it to clipboard</p>
  <pre><code>import tkinter.messagebox
  import string
  import random
  
  
  def qs_msgbbox():   # qs_msgbbox
      tkinter.messagebox.showinfo(&quot;Info&quot;, &quot;For customer support or tip or rating contact:&quot;
                                          &quot;dghaily725@gmail.com\npress the button for generated pass\nmsg will appear then copy\nthe generated password&quot;)
  
  
  def gen_pass(k=9):  # gen_pass
      char = &quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&amp;*&quot;
      password = ''
      for i in range(9):
          password += random.choice(char)
      tkinter.messagebox.showinfo(&quot;Password&quot;, password)
  root = Tk()
  root.title(&quot;Password Generator&quot;)
  
  lbl1 = Label(root, text=&quot;Generate Password&quot;, bd=2, relief=SUNKEN, height=5, width=50, bg='black', fg='white')
  lbl1.configure(font=(70))
  lbl1.grid(row=0, column=2)
  
  lbl2 = Label(root, text='For more information press the Question mark', bd=2, relief=SUNKEN, fg='red')
  lbl2.configure(font=(70))
  lbl2.grid(row=0, column=0, pady=10)
  
  
  btn1 = Button(root, text='Press to Generate', height=5, width=50, bg='grey', command=gen_pass)
  btn1.configure(font=(70))
  btn1.grid(row=1, column=2, padx=460, pady=50)
  
  btn2photo = PhotoImage(file='question.png')
  btn2 = Button(root, image=btn2photo, width=30, height=30, command= qs_msgbbox)
  btn2.grid(row=0, column=1)
  
  root.mainloop()
  </code></pre>
  <p>and also just a quick small question is it better to use classes or this form</p>