here2share

# Tk_rounded_entry.py

Oct 22nd, 2020 (edited)
1,005
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Tk_rounded_entry.py
  2.  
  3. from Tkinter import *
  4. from math import sin, cos, pi
  5.  
  6. root = Tk()
  7. root.title("Tk Rounded Entry")
  8. ### root.withdraw() # vs root.deiconify()')
  9. xm,ym = 240,80
  10.  
  11. canvas = Canvas(root, width=xm, height=ym)
  12. canvas.grid()
  13.  
  14. x1,y1 = 40,40
  15. x2,r = 200,30
  16.  
  17. vertex_count = 100
  18. t =  pi/vertex_count
  19. a = 1.577
  20. VERTEX = [(x1,y1+r)]
  21. VERTEX += [(    x1+r*cos(i*2*t+a), \
  22.                 y1+r*sin(i*2*t+a)) for i in range(vertex_count/2)]
  23. VERTEX += [(x2,y1-r)]
  24. VERTEX += [[(   x2+r*cos(i*2*t+a), \
  25.                 y1+r*sin(i*2*t+a))] for i in range(vertex_count/2,vertex_count)]
  26. canvas.create_polygon(VERTEX, fill='white', width=5, outline='green')
  27.  
  28. fff = ' '.join(['ariel', '18', 'italic'])
  29. sss = StringVar()
  30. ent = Entry(text=sss, font=fff, bg='white', relief=FLAT, width=15)
  31. ent.place(x=x1-16,y=y1-15)
  32. sss.set('Hello World !!!')
  33.  
  34.  
  35. root.mainloop()
RAW Paste Data