Advertisement
here2share

# Tk_png_zlib_base64.py

May 30th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.94 KB | None | 0 0
  1. # Tk_png_zlib_base64.py
  2.  
  3. py_png_b64='''\
  4. eJxtV8nOszASPOd7FQ4hbCFHs5vdLAFyYwt7gJDEwNMP/2iOY8kSIBnb1VXV3SeP7FVH6msEBADc
  5. HPxvuBYGsY1B6gCQIAwyhEBxzCzAoPQxiEJkDagCrY/ll4+Tb4DH8e/kV9XHB/jtA9DfAagiBIYI
  6. gPlege8dg2+M8m8E8CVACxvXHekjsCQYrA8ALgkCZAYAd8xzseHz3ykEK8iqVS1rVki8Vcs8zygE
  7. z342LIxF1klFHRWiHT73IkjbHiXtJUwDPSqkR1WSQpyGj0cqX4q009O/Uy4Lz6fc1znZN2XYD8/w
  8. 1pfooVeCd28FNmu3qax3O653JauCPq+bR9u3dVfv3tQ362fcbTzuymXeJ+bvNJNCWcveUMt235DF
  9. UoePX9t9tr674E6+UV3/+VV3ATf36VJd+q2595emv7HtRaD7y53u+prrB4Fqos/179SHkfQNU/iT
  10. Z3HpBvXbc+LYU8p8983P3bF/99n69IS9RCl8DQPo1U19aY7aa6o2xKrxes16Rw/WQH+9428xhV6U
  11. r07DDMeIcCdqc95q6X1j1RxfpTNqqTvSfjDRpf+ON298RY9vTFW/wYlwRKWYGsrt5TzxS63/Tlv8
  12. rTG99RvdzDu9TTvt96QmTpfpQ2gpJ0ucD2Ruk9S59JSrIwvZHIjvJlDe3FM2Nt1MHckyokifI//v
  13. ZF2jAF7TyOaoRn/PvfEuO0dvHI/9eoHhB96cxveUyu7X4eFdh+JuDOWDo4qUo8r8Kj6L67f13uIQ
  14. v9XP3ym6bmM0c206b02eRVV6daYsm4/pv8ts+JaWGou8nyq5/9BzJ7fzuVU//qjl1KTz29vJ1Yt7
  15. a75GoR4xNQuRdT8Ddu2ZtWzq5ubft5/Pn+ij8v7ti/2bysc36hIvwy/Lqa24ibfcPoPQ1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Yw3VgBabzjeeHuNB19WZK33TBg+X2dznKlyTt/VHm8OYpJHzv1zlJ6zROY83G2fCbN
  57. m87FZZPxzMWJq+jmUyqMcdLIF3sh+R29iutwaxx4f6xanOpnUaZ91bPvnTSuT+1ckivZfNIzdVSq
  58. 4qVFsM5sA1Qrp2z6cncnxUF8lg6F8s1jCsO4MB4ailmhudcM+hx7jQketGTD3JHtgtezRt3EJJ+j
  59. r/9w0O91oLBz8ZXUJMFne3DjzMki1Yz6oFHTnFn9CXbx5FYmrjb7ADC5fTLVaO2y5EaN7J8/2Qwu
  60. 3qFTIv3GhD+E+9PubMJN8F6p1/houAn2WtWtd76Sb9F4ujnFTA5/NXkrxE9TI3n4OUOzc+dWToPn
  61. rVaEmP87XV+3M4pN93y+0k8yF476+Pofbeh1KA=='''
  62. #
  63.  
  64. from Tkinter import Tk, Canvas
  65. from cStringIO import StringIO
  66. from PIL import ImageTk, Image
  67. import base64, zlib
  68. root = Tk()
  69. z = base64.decodestring(py_png_b64)
  70. z = zlib.decompress(z)
  71. z = StringIO(base64.decodestring(z))
  72. z = Image.open(z)
  73. tkimg = ImageTk.PhotoImage(z)
  74. canvas = Canvas(root, height=200, width=200)
  75. canvas.grid()
  76. canvas.create_image(100, 100, image=tkimg)
  77. def stamp(event):
  78.     canvas.create_image(event.x, event.y, image=tkimg)
  79. canvas.bind('<ButtonPress-1>', stamp)
  80. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement