]> Nutra Git (v2) - gamesguru/getmyancestors.git/commitdiff
Use style with ttk and grid positions
authorBenoît Fontaine <benoit.fontaine@acft.fr>
Sun, 18 Feb 2018 18:25:29 +0000 (19:25 +0100)
committerBenoît Fontaine <benoit.fontaine@acft.fr>
Sun, 18 Feb 2018 18:25:29 +0000 (19:25 +0100)
gui.py

diff --git a/gui.py b/gui.py
index a58892d5ff501d772a9f9546eb9ebd547c5288f6..513c6e5ff7c0edfc592eca4c55c5758396f79368 100644 (file)
--- a/gui.py
+++ b/gui.py
@@ -14,14 +14,14 @@ class SignIn(Frame):
         super(SignIn, self).__init__(window, **kwargs)
         self.username = StringVar()
         self.password = StringVar()
-        label_username = Label(self, text='Username')
+        label_username = Label(self, text='Username:')
         entry_username = Entry(self, textvariable=self.username, width=30)
-        label_password = Label(self, text='Password')
+        label_password = Label(self, text='Password:')
         entry_password = Entry(self, show='●', textvariable=self.password, width=30)
-        label_username.pack()
-        entry_username.pack()
-        label_password.pack()
-        entry_password.pack()
+        label_username.grid(row=0, column=0, pady=15, padx=(0, 5))
+        entry_username.grid(row=0, column=1)
+        label_password.grid(row=1, column=0, padx=(0, 5))
+        entry_password.grid(row=1, column=1)
         entry_username.focus_set()
         entry_username.bind('<Key>', self.enter)
         entry_password.bind('<Key>', self.enter)
@@ -40,9 +40,9 @@ class StartIndi(Frame):
         self.btn_delete = Button(self, text='delete', command=self.delete)
         entry_fid = Entry(self, textvariable=self.fid, width=10)
         entry_fid.bind('<FocusOut>', self.get_data)
-        self.label_fid.pack()
-        entry_fid.pack()
-        self.btn_delete.pack()
+        self.label_fid.grid(row=0, column=0)
+        entry_fid.grid(row=0, column=1)
+        self.btn_delete.grid(row=0, column=2)
 
     def get_data(self, evt):
         if re.match(r'[A-Z0-9]{4}-[A-Z0-9]{3}', self.fid.get()):
@@ -79,31 +79,31 @@ class Options(Frame):
         self.contributors = IntVar()
         self.start_indis = list()
         self.indis = Frame(self)
-        label_ancestors = Label(self, text='Number of generations to ascend')
+        label_ancestors = Label(self, text='Number of generations to ascend:')
         entry_ancestors = Entry(self, textvariable=self.ancestors, width=3)
-        label_descendants = Label(self, text='Number of generations to descend')
+        label_descendants = Label(self, text='Number of generations to descend:')
         entry_descendants = Entry(self, textvariable=self.descendants, width=3)
         btn_add_indi = Button(self, text='add', command=self.add_indi)
         btn_spouses = Checkbutton(self, text='Add spouses and couples information', variable=self.spouses)
         btn_ordinances = Checkbutton(self, text='Add temple information', variable=self.ordinances)
         btn_contributors = Checkbutton(self, text='Add list of contributors in notes', variable=self.contributors)
-        label_ancestors.pack()
-        entry_ancestors.pack()
-        label_descendants.pack()
-        entry_descendants.pack()
-        self.indis.pack()
-        btn_add_indi.pack()
-        btn_spouses.pack()
+        label_ancestors.grid(row=0, column=0)
+        entry_ancestors.grid(row=0, column=1)
+        label_descendants.grid(row=1, column=0)
+        entry_descendants.grid(row=1, column=1)
+        self.indis.grid(row=2, sticky='ew', column=0, columnspan=2)
+        btn_add_indi.grid(row=3, sticky='ew', column=0, columnspan=2)
+        btn_spouses.grid(row=4, sticky='w')
         if ordinances:
-            btn_ordinances.pack()
-        btn_contributors.pack()
+            btn_ordinances.grid(row=5, sticky='w')
+        btn_contributors.grid(row=6, sticky='w')
         entry_ancestors.focus_set()
 
     def add_indi(self, data=None):
         new_indi = StartIndi(self.indis)
         self.start_indis.append(new_indi)
         new_indi.add_data(data)
-        new_indi.pack()
+        new_indi.grid(sticky='nesw')
 
 
 class Gui(Frame):
@@ -117,15 +117,15 @@ class Gui(Frame):
         self.form = Frame(self)
         self.sign_in = SignIn(self.form)
         self.options = Options(self.form, True)
-        self.title = Label(self, text='Sign In to FamilySearch')
+        self.title = Label(self, text='Sign In to FamilySearch', font='a 12 bold')
         buttons = Frame(self)
         self.btn_quit = Button(buttons, text='Quit', command=self.quit)
         self.btn_valid = Button(buttons, text='Sign In', command=self.login)
         self.title.pack()
         self.sign_in.pack()
         self.form.pack()
-        self.btn_quit.pack(side='left')
-        self.btn_valid.pack(side='right')
+        self.btn_quit.pack(side='left', padx=(0, 40))
+        self.btn_valid.pack(side='right', padx=(40, 0))
         self.info_label.pack()
         buttons.pack()
         self.pack()