Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. from appJar import gui
  2. app=gui("Rubrica")
  3. app.setOnTop(stay=True)
  4. app.setResizable(False)
  5. app.setSize(500,400)
  6. app.setBg("lightblue")
  7. l=[]
  8. i=0
  9.  
  10. class Rubrica(object):
  11. def __init__(self,nome,numero,mail):
  12. self.nome=nome
  13. self.numero=numero
  14. self.mail=mail
  15. def modifica(self):
  16. print(self.nome)
  17. def elimina(self):
  18. print(self.numero)
  19.  
  20. def press3(pp):
  21. global i
  22. global l
  23. z=0
  24. for z in range(i):
  25. if pp==(str(z)):
  26. app.removeAllWidgets()
  27. app.addLabel("alt","Contatto "+l[z].nome,0,0)
  28. app.setLabelBg("alt", "yellow")
  29. app.addLabel("nome","Nome: "+l[z].nome,2,0)
  30. app.addLabel("numero","Numero: "+l[z].numero,3,0)
  31. app.addLabel("mail","Mail: "+l[z].mail,4,0)
  32. app.addNamedButton("<","sss",fai,6,0)
  33. def fai():
  34. global l
  35. global i
  36. app.removeAllWidgets()
  37. app.addLabel("B","Rubrica Contatti by Spataro",0,0)
  38. app.setLabelBg("B", "yellow")
  39. app.addEntry("Cerc",1,0)
  40. app.addButton("Cerca",press3,1,1)
  41. k=0
  42. u=0
  43. for k in range(i):
  44. if k==0:
  45. u=2
  46. app.addLabel("c"+str(k),l[k].nome,u+2,0)
  47. app.setLabelBg("c"+str(k), "orange")
  48. app.addNamedButton("Visualizza", str(k), press3,u+2,1)
  49. u=u+1
  50. app.addButton("Svuota Rubrica",press3,u+2,1)
  51. app.addButton("+",press,u+2,5)
  52. def press1(p):
  53. global l
  54. global i
  55. if p=="<":
  56. fai()
  57. if p=="Conferma":
  58. l.append("p")
  59. l[i]=Rubrica(app.getEntry("Nome"),app.getEntry("Numero"),app.getEntry("Mail"))
  60. i=i+1
  61. fai()
  62. def press(pulsante):
  63. if pulsante=="+":
  64. app.removeAllWidgets()
  65. app.addLabel("A","Nuovo Contatto",0,0)
  66. app.setLabelBg("A", "white")
  67. app.addLabelEntry("Nome",1,0)
  68. app.addLabelEntry("Numero",2,0)
  69. app.addLabelEntry("Mail",3,0)
  70. app.addButton("<",press1,5,0)
  71. app.addButton("Conferma",press1,5,5)
  72.  
  73.  
  74. fai()
  75. """
  76. x=Rubrica("Ciao","356")
  77. y=Rubrica("Bello","467")
  78. x.stampa()
  79. y.stampa()
  80. x.stampa1()
  81. y.stampa1()
  82. """
  83.  
  84. app.go()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement