In acest proiect urmarim realizarea unei agende telefonice care sa contina un camp cu numele si prenumele persoanei si numarul de telefon aferent.
Acest proiect este afisat in github.com si puteti obtine codul sursa care este compatibil cu python 2.x pe orice sistem(Windows, linux sau MacOS) la adresa: http://github.com/mhcrnl/python_tkinter_phonebook.git
Acesta este codul pentru realizarea ferestrei in care v-om crea widgeturile necesare aplicatiei:
Adaugarea meniului:
Referinte:
http://stackoverflow.com/questions/17466561/best-way-to-structure-a-tkinter-application
http://zetcode.com/gui/tkinter/menustoolbars/
http://stackoverflow.com/questions/16115378/tkinter-example-code-for-multiple-windows-why-wont-buttons-load-correctly
Acest proiect este afisat in github.com si puteti obtine codul sursa care este compatibil cu python 2.x pe orice sistem(Windows, linux sau MacOS) la adresa: http://github.com/mhcrnl/python_tkinter_phonebook.git
Acesta este codul pentru realizarea ferestrei in care v-om crea widgeturile necesare aplicatiei:
1: #Import as tk requires prefix "tk."
2: import Tkinter as tk
3: #Import Tkinter is global import
4: import Tkinter
5: class PhoneBook(tk.Frame):
6: def __init__(self, parent, *args, **kwargs):
7: tk.Frame.__init__(self, parent, *args, **kwargs)
8: self.parent = parent
9: #<create the rest of your GUI here>
10: parent.title("PhoneBook")
11: parent.geometry("400x400+100+140")
12: def main():
13: root = tk.Tk()
14: PhoneBook(root)
15: root.mainloop()
16: root.destroy()
17: if __name__ == "__main__":
18: main()
Aceasta este imaginea ferestrei realizate in codul de mai sus:Adaugarea meniului:
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Exit", command=self.quit)
menubar.add_cascade(label="File", menu=fileMenu)
Referinte:
http://stackoverflow.com/questions/17466561/best-way-to-structure-a-tkinter-application
http://zetcode.com/gui/tkinter/menustoolbars/
http://stackoverflow.com/questions/16115378/tkinter-example-code-for-multiple-windows-why-wont-buttons-load-correctly