本文整理汇总了Python中Tkinter.Tk.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.configure方法的具体用法?Python Tk.configure怎么用?Python Tk.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def main():
tk = Tk()
menuBar = Pmw.MainMenuBar(tk)
def command():
print('Pressed')
menuBar.addmenu('File', 'File')
menuBar.addmenuitem(
'File', 'command', 'Close',
command=command,
label='Close'
)
insertmenuitem(
menuBar,
'File', 'command', 'Open',
command=command,
index=0,
label='Open'
)
tk.configure(menu=menuBar)
tk.mainloop()
示例2: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def main():
DEFAULTVALUE_OPTION = 'Restart (choose color from list)'
root = Tk()
root.title('Lets Play Alien Tiles!')
root.geometry('478x340')
root.configure(background='black')
row = 1
global buttons
for i in range(7):
for j in range(7):
b = tk.Button(text="0",command= lambda x1=i, y1=j: pressed(x1,y1), bg = 'red', width=5)
b.grid(row = i, column = j)
buttons.append(b)
pattern = tk.Label(text="Pattern")
pattern.grid( row = 8, column = 2, columnspan=3, sticky=W+E)
global entry
entry = tk.Entry(bd =5)
entry.grid(row=9, column = 1, columnspan=5, sticky=W+E)
bo = tk.Button(text="Original Page",command=web)
bo.grid( row = 14, column = 5, columnspan=2, padx = 15, pady = 15)
optionList = ('Restart (choose color from list)','red', 'green', 'blue', 'purple')
global v
v = StringVar()
v.set(optionList[0])
defaultOption = StringVar()
om = OptionMenu(root, v, *optionList)
defaultOption.set(DEFAULTVALUE_OPTION)
om.grid( row = 13, column = 0, columnspan=4, pady = 10)
confirm = tk.Button(text="Confirm",command=restart)
confirm.grid( row = 14, column = 1, columnspan=2)
confirm.place(anchor= SE, x=160, y=320)
root.mainloop()
示例3: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def __init__(self):
window=Tk()
window.title('Scientific Calculator')
window.configure(background="white")
self.string=StringVar()
entry=Entry(window,textvariable=self.string)
entry.grid(row=0,column=0,columnspan=6)
entry.configure(background="white")
entry.focus()
values=["7","8","9","/","%","clear","AC",
"4","5","6","*","(",")","**",
"1","2","3","-","=",",","0",".","min","+","sin","asin","cos","acos","tan()",
"pow","log10","max","abs","floor","pi","e","log","ceil","degrees","radians"]
text=1
i=0
row=1
col=0
for txt in values:
padx=10
pady=10
if(i==7):
row=2
col=0
if(i==14):
row=3
col=0
if(i==19):
row=4
col=0
if(i==26):
row=5
col=0
if(i==33):
row=6
col=0
if(txt=='='):
btn=Button(window,height=2,width=4,padx=70,pady=pady,text=txt,command=lambda txt=txt:self.equals())
btn.grid(row=row,column=col,columnspan=3,padx=2,pady=2)
btn.configure(background="yellow")
elif(txt=='clear'):
btn=Button(window,height=2,width=4,padx=padx,pady=pady, text=txt ,command=lambda txt=txt:self.delete())
btn.grid(row=row,column=col,padx=1,pady=1)
btn.configure(background="grey")
elif(txt=='AC'):
btn=Button(window,height=2,width=4,padx=padx,pady=pady,text=txt,command=lambda txt=txt:self.clearall())
btn.grid(row=row,column=col,padx=1,pady=1)
btn.configure(background="red")
else:
btn=Button(window,height=2,width=4,padx=padx,pady=pady,text=txt ,command=lambda txt=txt:self.addChar(txt))
btn.grid(row=row,column=col,padx=1,pady=1)
btn.configure(background="cyan")
col=col+1
i=i+1
window.mainloop()
示例4: test2
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def test2():
# test w/o scrolling canvas
root = Tk()
root.configure(bd=0)
canvas = Canvas(root, bg="white", highlightthickness=0)
canvas.pack(expand=1, fill="both")
item = FileTreeItem(os.curdir)
node = TreeNode(canvas, None, item)
node.update()
canvas.focus_set()
示例5: _test
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def _test():
import sys
from Tkinter import Tk
root = Tk()
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例6: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def main():
root = Tk()
#setting the window height and width
root.geometry("235x200+100+100")
#setting background color
root.configure(background='grey')
#setting window title
root.title("Calculator")
root.resizable(0,0)
textframe = calculator(root)
root.mainloop()
示例7: f
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def f(marks,prb):
if len(marks)!=1:
print "Error"
else:
#states = ["A+","A","A-", "B+","B","B-","C+","C","C-", "F"]
states = ["A","B","C", "F"]
n_states = len(states)
observations = ["Sub1:A+","Sub1:A","Sub1:A-", "Sub1:B+", "Sub1:B", "Sub1:B-", "Sub1:C+", "Sub1:C", "Sub1:C_","Sub1:F"]
n_observations = len(observations)
#Starting proberbilities
start_probability = np.array([0.25, 0.25,0.25, 0.25])
#Transision proberbilities
transition_probability = np.array([[0.4, 0.3,0.2, 0.1],[0.3, 0.4,0.2, 0.1],[0.1, 0.3,0.4, 0.2],[0.1, 0.2,0.3, 0.4]])
# Emission proberbilities are read from file
emission_probability = np.array(prb)
model = hmm.MultinomialHMM(n_components=n_states)
model._set_startprob(start_probability)
model._set_transmat(transition_probability)
model._set_emissionprob(emission_probability)
bob_says = marks
#bob_says=[0]
logprob, pred = model.decode(bob_says, algorithm="viterbi")
# Display the result
print "Previous Exam Result:", ", ".join(map(lambda x: observations[x], bob_says))
print "Predicted Software Engineering Result:", ", ".join(map(lambda x: states[x], pred))
'''
If C and F values are not get as a predicted then student is displayed as approved
'''
if (pred[0]!=3)&(pred[0]!=2):
con="Student Approved"
else:con="Not Sufficient Requirement"
# Create GUI
window = Tk()
window.configure(background='#8A002E')
window.title('Margov Prediction')
window.geometry('480x200') # Size 200, 200
frame = Frame(window,background='#8A002E')
frame.pack()
def back():
window.withdraw()
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text="Student's predicted success:").grid(row=0, column=0)
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text=map(lambda x: states[x], pred)).grid(row=0, column=1)
Label(frame,background='#8A002E', text=con,fg="red",font=("Helvetica", 20)).grid(row=1, column=0)
Button(frame, text='Next', command=back).grid(row=2, column=2, sticky=W, pady=4)
return pred[0]
示例8: _object_browser
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def _object_browser(parent):
import sys
from Tkinter import Tk
root = Tk()
root.title("Test ObjectBrowser")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 150))
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例9: f
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def f(marks,prb):
if len(marks)!=1:
print "Error"
else:
#states = ["A+","A","A-", "B+","B","B-","C+","C","C-", "F"]
states = ["A","B","C", "F"]
n_states = len(states)
#observations = ["OOP-A", "OOP-B", "OOP-C","OOP-F"]
observations = ["Sub1:A+","Sub1:A","Sub1:A-", "Sub1:B+", "Sub1:B", "Sub1:B-", "Sub1:C+", "Sub1:C", "Sub1:C_","Sub1:F"]
n_observations = len(observations)
start_probability = np.array([0.25, 0.25,0.25, 0.25])
#transition_probability = np.array([[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025],[0.2,0.2,0.2,0.1,0.075,0.075,0.05,0.05, 0.025,0.025],[0.1,0.2,0.2,0.2,0.075,0.075,0.05,0.05, 0.025,0.025],[0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05, 0.025,0.025],[0.05,0.075,0.1,0.2,0.2,0.2,0.075,0.05, 0.025,0.025],[0.05,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.025,0.025],[ 0.025,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05,0.025],[ 0.025,0.025,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05],[0.025,0.025,0.05,0.1,0.2,0.2,0.2,0.075,0.075,0.05 ],[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025]])
transition_probability = np.array([[0.4, 0.3,0.2, 0.1],[0.3, 0.4,0.2, 0.1],[0.1, 0.3,0.4, 0.2],[0.1, 0.2,0.3, 0.4]])
#emission_probability = np.array([[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1],[0.1, 0.1,0.1, 0.1,0.1,0.1, 0.1,0.1, 0.1,0.1]])
#emission_probability=np.array([[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025],[0.2,0.2,0.2,0.1,0.075,0.075,0.05,0.05, 0.025,0.025],[0.1,0.2,0.2,0.2,0.075,0.075,0.05,0.05, 0.025,0.025],[0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05, 0.025,0.025],[0.05,0.075,0.1,0.2,0.2,0.2,0.075,0.05, 0.025,0.025],[0.05,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.025,0.025],[ 0.025,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05,0.025],[ 0.025,0.025,0.075,0.1,0.2,0.2,0.2,0.075,0.05,0.05],[0.025,0.025,0.05,0.1,0.2,0.2,0.2,0.075,0.075,0.05 ],[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025]])
#emission_probability=np.array([[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25],[0.25,0.25,0.25, 0.25]])
#emission_probability=np.array([[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025],[0.2,0.2,0.2,0.1,0.075,0.075,0.05,0.05, 0.025,0.025],[0.2,0.2,0.1, 0.1,0.1,0.1,0.075,0.075, 0.025,0.025],[0.1,0.075,0.075,0.05,0.05, 0.025,0.025,0.2,0.2,0.2]])
#emission_probability = np.array([[0.4, 0.2,0.2, 0.2],[0.4, 0.2,0.2, 0.2],[0.4, 0.2,0.2, 0.2],[0.4, 0.2,0.2, 0.2]])
emission_probability = np.array(prb)
model = hmm.MultinomialHMM(n_components=n_states)
model._set_startprob(start_probability)
model._set_transmat(transition_probability)
model._set_emissionprob(emission_probability)
bob_says = marks
#bob_says=[0]
logprob, pred = model.decode(bob_says, algorithm="viterbi")
print "Previous Exam Result:", ", ".join(map(lambda x: observations[x], bob_says))
print "Predicted Software Engineering Result:", ", ".join(map(lambda x: states[x], pred))
if (pred[0]!=3)&(pred[0]!=2):
con="Student Approved"
else:con="Not Sufficient Requirenment"
window = Tk()
window.configure(background='#8A002E')
window.title('Margov Prediction')
window.geometry('450x200') # Size 200, 200
frame = Frame(window,background='#8A002E')
frame.pack()
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text="Student's predicted success:").grid(row=0, column=0)
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text=map(lambda x: states[x], pred)).grid(row=0, column=1)
Label(frame,background='#8A002E', text=con,fg="red",font=("Helvetica", 24)).grid(row=1, column=0)
Button(frame, text='Quit', command=window.quit).grid(row=2, column=2, sticky=W, pady=4)
return pred[0]
示例10: error_and_exit
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def error_and_exit(title, main_text):
"""
Show a pop-up window and sys.exit() out of Python.
:param title: the short error description
:param main_text: the long error description
"""
# NOTE: We don't want to load all of these imports normally.
# Otherwise we will have these unused GUI modules loaded in the main process.
from Tkinter import Tk, Canvas, DISABLED, INSERT, Label, Text, WORD
root = Tk()
root.wm_title("Tribler: Critical Error!")
root.wm_minsize(500, 300)
root.wm_maxsize(500, 300)
root.configure(background='#535252')
# Place the window at the center
root.update_idletasks()
w = root.winfo_screenwidth()
h = root.winfo_screenheight()
size = tuple(int(_) for _ in root.geometry().split('+')[0].split('x'))
x = w / 2 - 250
y = h / 2 - 150
root.geometry("%dx%d+%d+%d" % (size + (x, y)))
Canvas(root, width=500, height=50, bd=0, highlightthickness=0, relief='ridge', background='#535252').pack()
pane = Canvas(root, width=400, height=200, bd=0, highlightthickness=0, relief='ridge', background='#333333')
Canvas(pane, width=400, height=20, bd=0, highlightthickness=0, relief='ridge', background='#333333').pack()
Label(pane, text=title, width=40, background='#333333', foreground='#fcffff', font=("Helvetica", 11)).pack()
Canvas(pane, width=400, height=20, bd=0, highlightthickness=0, relief='ridge', background='#333333').pack()
main_text_label = Text(pane, width=45, height=6, bd=0, highlightthickness=0, relief='ridge', background='#333333',
foreground='#b5b5b5', font=("Helvetica", 11), wrap=WORD)
main_text_label.tag_configure("center", justify='center')
main_text_label.insert(INSERT, main_text)
main_text_label.tag_add("center", "1.0", "end")
main_text_label.config(state=DISABLED)
main_text_label.pack()
pane.pack()
root.mainloop()
# Exit the program
sys.exit(1)
示例11: predict
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
def predict():
student = e1.get()
if int(getNoSubs())==1:
S1_CA= e2.get()
S1_WE= e3.get()
val=model1(student,S1_CA,S1_WE)
if int(getNoSubs())==2:
S1_CA= e2.get()
S1_WE= e3.get()
S2_CA= e4.get()
S2_WE= e5.get()
val=model2(student,S1_CA,S2_CA,S1_WE,S2_WE)
if int(getNoSubs())==3:
S1_CA= e2.get()
S1_WE= e3.get()
S2_CA= e4.get()
S2_WE= e5.get()
S3_CA= e6.get()
S3_WE= e7.get()
val=model3(student,S1_CA,S2_CA,S3_CA,S1_WE,S2_WE,S3_WE)
print val
con=""
if val>50.0:
con="Approved"
else:
con="Not Sufficient Requirenment"
window = Tk()
window.configure(background='#8A002E')
window.title('Margov Prediction')
window.geometry('300x250') # Size 200, 200
frame = Frame(window,background='#8A002E')
frame.pack()
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text=student+"'s predicted sucess:").grid(row=0, column=0)
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text=val).grid(row=0, column=1)
Label(frame, background='#8A002E',font=("Helvetica", 14),foreground="white",text="%").grid(row=0, column=2)
Label(frame,background='#8A002E', text=con,fg="red",font=("Helvetica", 24)).grid(row=1, column=0)
Button(frame, text='Quit', command=window.quit).grid(row=2, column=2, sticky=W, pady=4)
示例12: Example
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
from Tkinter import Tk
import base64
import tkMessageBox as box
import os
from PIL import Image, ImageTk
class Example():
def onError(self):
box.showerror("Error", "Login Fail")
def onInfo(self):
box.showinfo("Information", "Login Sucessfully")
mastert = Tk()
mastert.configure(background='#8A002E')
img = ImageTk.PhotoImage(Image.open("logo4.jpg"))
imglabel = Label(mastert, image=img).grid(row=0, column=3)
mastert.wm_title("System Login")
Label(mastert,background='#8A002E',foreground="white", text="Enter System UserName").grid(row=1)
Label(mastert, background='#8A002E',foreground="white",text="Enter System Passwor:").grid(row=2)
e1 = Entry(mastert)
e2 = Entry(mastert)
e1.grid(row=1, column=1)
e2.grid(row=2, column=1)
#read password from file-------------------
def getUserUserNm(user):
tem=[]
示例13: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
class Game:
def __init__(self):
self.root = Tk()
self.frame1 = None
self.frame2 = None
self.w = None
self.scoreC = None
self.score = 0
self.hor = True
self.upid = self.downid = self.rightid = self.leftid = 0
self.head = -1
self.time = 700
def home(self):
self.frame1 = Frame(self.root, width=750, height=350, padx=250, bg="black")
self.frame2 = Frame(self.root, height=250, width=750, bg="black", padx=25)
self.root.wm_minsize(width=750, height=666)
self.root.configure(bg="black")
self.frame1.pack_propagate(0)
self.frame1.update()
self.frame1.configure(pady=self.frame1.cget("height") / 2.5)
logo = PhotoImage(file="Game_Logo.gif")
starth = Button(self.frame1, text="Hard", bg="orange", padx=25, pady=5,
font=Font(family="comic sans MS", size=10),
command=lambda: self.callgame(40))
startm = Button(self.frame1, text="Medium", bg="teal", padx=25, pady=5,
font=Font(family="comic sans MS", size=10),
command=lambda: self.callgame(60))
starte = Button(self.frame1, text="Easy", bg="orange", padx=25, pady=5,
font=Font(family="comic sans MS", size=10),
command=lambda: self.callgame(75))
self.frame2.pack_propagate(0)
exp = """ This is a game in which
the arrow keys are used
to move the snake around
and to get points"""
exf = Font(family="comic sans MS", size=20)
Label(self.frame2, image=logo, bg="black", text=exp, padx=10).pack(side="right")
Label(self.frame2, fg="white", bg="black", text=exp, justify="left", font=exf).pack(side="left")
starte.grid(row=0, columnspan=2)
startm.grid(row=0, columnspan=2, column=4, padx=18)
starth.grid(row=0, columnspan=2, column=8)
head = Font(family="comic sans MS", size=30)
self.H=Label(self.root, text="SNAKES", font=head, fg="orange", bg="black", pady=10)
self.H.pack()
self.frame2.pack(expand=True)
self.frame1.pack(expand=True)
self.root.mainloop()
def callgame(self, time):
self.time = time
self.game()
def calldown(self, key):
if self.hor:
self.w.after_cancel(self.leftid)
self.w.after_cancel(self.rightid)
self.down(0)
def callup(self, key):
if self.hor:
self.w.after_cancel(self.leftid)
self.w.after_cancel(self.rightid)
self.up(0)
def callright(self, key):
if not self.hor:
self.w.after_cancel(self.upid)
self.w.after_cancel(self.downid)
self.right(0)
def callleft(self, key):
if not self.hor:
self.w.after_cancel(self.upid)
self.w.after_cancel(self.downid)
self.left(0)
def game(self):
self.score = 0
self.w = Canvas(self.root, width=750, height=500, relief="flat", highlightbackground="grey",
highlightthickness=10)
self.frame1.destroy()
self.frame2.destroy()
self.root.configure(width=1000, padx=10)
self.root.pack_propagate(0)
self.w.configure(background="black")
self.w.pack(side="left")
self.w.create_line(300, 250, 450, 250, width=10, fill="teal")
self.scoreC = Label(self.root, text="Score\n" + str(self.score), bg="black", fg="teal", padx=25, pady=35,
font=Font(family="comic sans MS", size=25))
self.head = self.w.create_line(450, 250, 455, 250, width=10, fill="white")
self.scoreC.pack(side="top")
self.root.bind("<Up>", self.callup)
self.root.bind("<Down>", self.calldown)
self.root.bind("<Right>", self.callright)
self.root.bind("<Left>", self.callleft)
self.createFood()
self.right(0)
def down(self, i):
#.........这里部分代码省略.........
示例14: onError
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
"""
This is the class for Configure the hidden marcov model for differen number of relate subject of the system.
This can be verify upto 3 subject which is related to current considering subject.
This write the calculate proberbility value in the text file at the configeration level
"""
# system error handling
class Example:
def onError(self):
box.showerror("Error", "Error : Maximum no of subjects exeed ")
def onInfo(self):
box.showinfo("Information", "Value Write Sucessfully")
mastert = Tk()
mastert.configure(background="#8A002E")
img = ImageTk.PhotoImage(Image.open("logo4.jpg"))
imglabel = Label(mastert, image=img).grid(row=0, column=3)
mastert.wm_title("System Login")
Label(mastert, background="#8A002E", foreground="white", text="Enter Nuber Of Subjects:").grid(row=1)
Label(mastert, background="#8A002E", foreground="white", text="(Enter subject marks to the txt files ").grid(
row=2, column=0
)
Label(mastert, background="#8A002E", foreground="white", text="names data1.txt,data2,txt and maximum data3.txt)").grid(
row=2, column=1
)
e1 = Entry(mastert)
e1.grid(row=1, column=1)
def Fun():
示例15: AddPOI_GUI
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import configure [as 别名]
class AddPOI_GUI(threading.Thread):
def __init__(self, parent):
threading.Thread.__init__(self)
self.parent = parent
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.th_R = self.parent.ThreadReception(self.sock, self)
print self.th_R.getName()
self.rootM = Tk()
def run(self):
print "before thread reception"
self.rootM.configure(bg='black')
self.rootM.title = "ZBot lite py"
self.tabPage = TabbedPageSet(self.rootM,
page_names=['Logs',
'AddPoi',
'POIList.xml',
'WhiteList',
'HTTP_Server',
'Keystones Locations',
'FTP Client'], bg="#000000", n_rows=0, expand_tabs=True, )
self.tabPage.pages['Logs'].frame.configure(bg="#000000")
self.tabPage.pages['AddPoi'].frame.configure(bg="#000000")
self.tabPage.pages['POIList.xml'].frame.configure(bg="#000000")
self.tabPage.pages['WhiteList'].frame.configure(bg="#000000")
self.tabPage.pages['HTTP_Server'].frame.configure(bg="#000000")
self.tabPage.pages['Keystones Locations'].frame.configure(bg="#000000")
self.tabPage.pages['FTP Client'].frame.configure(bg="#000000")
strs1 = StringVar()
strs2 = StringVar()
strs3 = StringVar()
strs4 = StringVar()
strsp1 = StringVar()
strsp2 = StringVar()
strs1.set(self.parent.parent.settings['sPort'])
strs2.set(self.parent.parent.settings['sIp'])
strs3.set(self.parent.parent.settings['sPass'])
strs4.set("say ")
strsp1.set(self.parent.parent.settings['http_server_port'])
strsp2.set(int(self.parent.parent.settings['http_server_port']) + 5)
"""7dtd Server Logs Tab"""
self.label1 = Label(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", borderwidth=1,
text="Server IP: ", )
self.label2 = Label(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", text="Server Port: ", )
self.label3 = Label(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", text="Server Password:", )
self.entry_1 = Entry(self.tabPage.pages['Logs'].frame, textvariable=strs4, bg="#000000", fg="#ff0000",
width=0, )
self.entry2 = Entry(self.tabPage.pages['Logs'].frame, textvariable=strs1, justify="center", relief="flat",
width=0, )
self.entry3 = Entry(self.tabPage.pages['Logs'].frame, textvariable=strs3, justify="center", relief="flat",
width=0, show="*")
self.button1 = Button(self.tabPage.pages['Logs'].frame, text="Connect", command=self.connect)
self.button2 = Button(self.tabPage.pages['Logs'].frame, text="Send", command=self.send)
self.sbar1 = Scrollbar(self.tabPage.pages['Logs'].frame)
self.sbar2 = Scrollbar(self.tabPage.pages['Logs'].frame)
self.text1 = Text(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", height=0, width=0, )
self.text2 = Text(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", height=0, width=0, )
self.text3 = Text(self.tabPage.pages['Logs'].frame, bg="#000000", fg="#ff0000", height=0, width=0, )
self.entry4 = Entry(self.tabPage.pages['Logs'].frame, textvariable=strs2, justify="center", relief="flat",
width=0, )
self.sbar1.config(command=self.text1.yview)
self.sbar1.config(command=self.text2.yview)
self.label1.grid(in_=self.tabPage.pages['Logs'].frame, column=1, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="")
self.entry4.grid(in_=self.tabPage.pages['Logs'].frame, column=2, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="ew")
self.label2.grid(in_=self.tabPage.pages['Logs'].frame, column=3, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="")
self.entry2.grid(in_=self.tabPage.pages['Logs'].frame, column=4, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="ew")
self.label3.grid(in_=self.tabPage.pages['Logs'].frame, column=5, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="")
self.entry3.grid(in_=self.tabPage.pages['Logs'].frame, column=6, row=1, columnspan=1, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="ew")
self.button1.grid(in_=self.tabPage.pages['Logs'].frame, column=8, row=1, columnspan=2, ipadx=0, ipady=0,
padx=5, pady=5, rowspan=1, sticky="nsew")
self.text1.grid(in_=self.tabPage.pages['Logs'].frame, column=1, row=2, columnspan=6, rowspan=1, ipadx=5,
ipady=0, padx=2, pady=5, sticky="news")
self.sbar1.grid(in_=self.tabPage.pages['Logs'].frame, column=7, row=2, columnspan=1, rowspan=1, ipadx=0,
ipady=0, padx=0, pady=5, sticky="nsew")
self.text2.grid(in_=self.tabPage.pages['Logs'].frame, column=8, row=2, columnspan=1, rowspan=1, ipadx=0,
ipady=0, padx=0, pady=5, sticky="nsew")
self.sbar2.grid(in_=self.tabPage.pages['Logs'].frame, column=9, row=2, columnspan=1, rowspan=1, ipadx=0,
ipady=0, padx=0, pady=5, sticky="nsew")
self.entry_1.grid(in_=self.tabPage.pages['Logs'].frame, column=1, row=3, columnspan=7, rowspan=1, ipadx=5,
ipady=0, padx=2, pady=0, sticky="ew")
self.button2.grid(in_=self.tabPage.pages['Logs'].frame, column=8, row=3, columnspan=2, rowspan=1, ipadx=0,
ipady=0, padx=5, pady=5, sticky="ew")
self.tabPage.grid(in_=self.rootM, column=1, row=1, rowspan=3, columnspan=9, ipadx=5, ipady=0, padx=2,
pady=0, sticky="nsew")
self.entry_1.focus()
self.entry_1.bind('<Return>', (lambda event: self.send()))
#.........这里部分代码省略.........