Skip to content

Commit 1f25d63

Browse files
author
tittanlee
committed
1. add tree view for group list.
2. add stausbar module.
1 parent f735922 commit 1f25d63

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

fbapp.py

+30-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ def __init__(self, parent):
1515
self.parent = parent
1616
self.parent.title("Facebook 自動行銷軟體")
1717
self.pack(fill=BOTH, expand=1)
18+
19+
self.status_bar = StatusBar(self)
20+
self.status_bar.set("Status:")
21+
self.status_bar.pack(fill = X, side = BOTTOM)
22+
1823
self.initUI()
1924

2025
def initUI(self):
@@ -26,6 +31,7 @@ def initUI(self):
2631
right_frame = Frame(self)
2732
self.create_right_frame_ui(right_frame)
2833
right_frame.pack(fill = BOTH, expand = 1, side = LEFT)
34+
2935

3036
def create_left_frame_ui(self, parent_frame):
3137
login_frame = Frame(parent_frame)
@@ -39,16 +45,31 @@ def create_left_frame_ui(self, parent_frame):
3945
self.textPad = ScrolledText(parent_frame, pady = 30, width = 70, height = 10, bg = "gray", bd = 3)
4046
self.textPad.pack(fill = X)
4147

42-
self.status_bar = StatusBar(parent_frame)
43-
self.status_bar.pack(side=BOTTOM, fill=X)
4448

4549

4650
def create_right_frame_ui(self, parent_frame):
47-
listbox = Listbox(parent_frame, width = 30, height = 40, bd = 3)
48-
listbox.pack()
49-
listbox.insert(END, "a list entry")
50-
for item in ["one", "two", "three", "four"]:
51-
listbox.insert(END, item)
51+
52+
self.random_sel_group = IntVar()
53+
Checkbutton(parent_frame, text="是否要隨機挑選群組", variable=self.random_sel_group, anchor = W).pack(side = TOP, anchor = W)
54+
55+
self.group_listbox = Treeview(parent_frame, columns = ("members", "privacy"))
56+
# self.group_listbox = Treeview(parent_frame)
57+
self.group_listbox.pack(side = TOP)
58+
59+
self.group_listbox.heading("#0", text="社團名稱", anchor = W)
60+
self.group_listbox.column("#0", stretch = True)
61+
62+
63+
self.group_listbox.heading("#1", text="社團人數", anchor = 'w')
64+
self.group_listbox.column("#1", stretch = True)
65+
66+
self.group_listbox.heading("#2", text="社團隱私", anchor = 'w')
67+
self.group_listbox.column("#2", stretch = True)
68+
69+
for digit in range(20):
70+
members = digit * 20
71+
attrs = "open"
72+
self.group_listbox.insert("" , "end", text=digit, values=(members, attrs))
5273

5374
def create_fbapp_login_frame(self, parnet_frame):
5475
Label(parnet_frame, text="電子郵件或電話 : ").grid(row= 0, sticky=E)
@@ -97,7 +118,7 @@ def create_fbapp_setting_frame(self, parnet_frame):
97118
f4.pack(fill = X)
98119

99120
f5 = Frame(parnet_frame)
100-
self.browse_button = Button(f5, text="開啟文案目錄", command=self.browse_file_directory, width=10)
121+
self.browse_button = Button(f5, text="指定文案目錄", command=self.browse_file_directory, width=10, bd = 5)
101122
self.browse_button.pack(side = LEFT)
102123
self.dir_name = StringVar()
103124
self.browse_dir_name = Entry(f5, width = 40, bd = 3 , textvariable = self.dir_name)
@@ -147,6 +168,6 @@ def facebook_auto(self):
147168

148169
root = Tk()
149170
# root.geometry("250x150+300+300")
150-
root.geometry("800x500")
171+
# root.geometry("800x500")
151172
app = FacebookApp(root)
152173
root.mainloop()

statusbar.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from tkinter import *
2+
class StatusBar(Frame):
3+
def __init__(self, master):
4+
Frame.__init__(self, master)
5+
self.label = Label(self, bd=1, relief=SUNKEN, anchor=W)
6+
self.label.pack(fill=X)
7+
def set(self, format, *args):
8+
self.label.config(text=format % args)
9+
self.label.update_idletasks()
10+
def clear(self):
11+
self.label.config(text="")
12+
self.label.update_idletasks()
13+
14+
def main():
15+
root=Tk()
16+
status = StatusBar(root)
17+
status.pack(side=BOTTOM, fill=X)
18+
mainloop()

0 commit comments

Comments
 (0)