本文整理汇总了Python中swampy.Gui.endrow方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.endrow方法的具体用法?Python Gui.endrow怎么用?Python Gui.endrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swampy.Gui
的用法示例。
在下文中一共展示了Gui.endrow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_color
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import endrow [as 别名]
def apply_color():
color = get_selection()
if color:
ca.itemconfig(item1, fill=color)
la = g.la(text="List of colors:")
g.row()
# lb is for listbox
lb = g.lb()
lb.bind("<ButtonRelease-1>", print_selection)
# sb is for scrollbar
sb = g.sb()
g.endrow()
bu = g.bu(text="Apply color", command=apply_color)
g.endcol()
# fill the listbox with color names
fp = open("/etc/X11/rgb.txt")
fp.readline()
for line in fp:
t = line.split("\t")
name = t[2].strip()
lb.insert(END, name)
# tell the listbox and the scrollbar about each other
示例2: main
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import endrow [as 别名]
def main():
"""
Launches login system everytime the script is run, users have the option of signing in, or signing up if they have not already established an account and accout information. Upon login/signup, the main application is launched
"""
def newusergui():
"""
for anyone who needs to register, this adds them to the database system
"""
def newuser():
global username
for user in users.find():
for info in user:
if user[info]==newusername.get():
label.config(text="That username is already in use.")
return
if newpassword.get()==repeatnewpassword.get():
users.insert({'user':newusername.get(), 'password': newpassword.get()})
db.add_user(newusername.get(), newpassword.get())
label.config(text="Thank you for signing up!")
username = newusername.get()
launch()
else:
label.config(text="Your passwords don't match! Please try again")
usernamelabel=g.la(text='Username:')
newusername=g.en()
newpasswordlabel=g.la(text='Password:')
newpassword=g.en(show='*')
repeatpasswordlabel=g.la(text='Re-enter Password')
repeatnewpassword=g.en(show='*')
button=g.bu(text="Let's get started!",command=newuser)
label=g.la()
def logingui():
"""
this launches the general sign-in gui for those who have registered
"""
def close():
global username
for user in users.find():
if password.get()==user['password'] and usernameentry.get() == user['user']:
label.config(text= "You are now logged in!")
username = usernameentry.get()
g.quit()
launch()
return True
else:
label.config(text= "We do not recognize your username or password, please try again.")
usernamelabel=g.la(text = "MusicSwAPPer Username: ")
usernameentry = g.en()
passwordlabel=g.la("MusicSwAPPer Password: ")
password = g.en(show = '*')
button=g.bu(text="Let's get started!",command=close)
label=g.la()
g=Gui()
g.title('Launch MusicSwAPPer')
signuporlogin = g.la(text = 'Please Sign-In or Sign-Up!')
g.row()
login = g.bu(text = 'Sign in', command=logingui)
sign = g.bu(text = 'Sign up', command=newusergui)
g.endrow()
g.mainloop()
示例3: main
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import endrow [as 别名]
def main():
client = MongoClient()
db = client.test_database
users = db.users
users.remove()
print users
users.insert({'user':'hey', 'password':'there'})
for thing in users.find():
print thing
def newusergui():
def close():
signupgui.quit()
def newuser():
for user in users.find():
for info in user:
print info
print user[info]
if user[info]==newusername.get():
print 'already in use'
label.config(text="That username is already in use.")
return
if newpassword.get()==repeatnewpassword.get():
print 'running this loop'
users.insert({'user':newusername.get(), 'password': newpassword.get()})
print users
label.config(text="Thank you for signing up!")
close()
launch()
return True
else:
label.config(text="Your passwords don't match! Please try again")
usernamelabel=signupgui.la(text='Username:')
newusername=signupgui.en()
newpasswordlabel=signupgui.la(text='Password:')
newpassword=signupgui.en(show='*')
repeatpasswordlabel=signupgui.la(text='Re-enter Password')
repeatnewpassword=signupgui.en(show='*')
button=signupgui.bu(text="Let's get started!",command=newuser)
label=signupgui.la()
def logingui():
def close():
for user in users.find():
for info in user:
if password.get()==user[info]:
label.config(text= "You are now logged in!")
signupgui.quit()
launch()
return True
else:
label.config(text= "We do not recognize your username or password, please try again.")
usernamelabel=signupgui.la(text = "MusicSwAPPer Username: ")
username = signupgui.en()
passwordlabel=signupgui.la("MusicSwAPPer Password: ")
password = signupgui.en(show = '*')
button=signupgui.bu(text="Let's get started!",command=close)
label=signupgui.la()
signupgui=Gui()
signupgui.title('MusicSwAPPer Sign Up')
signuporlogin = signupgui.la(text = 'Please Sign-In or Sign-Up!')
signupgui.row()
login = signupgui.bu(text = 'Sign in', command=logingui)
sign = signupgui.bu(text = 'Sign up', command=newusergui)
signupgui.endrow()
signupgui.mainloop()
示例4: launch
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import endrow [as 别名]
#.........这里部分代码省略.........
global username
for i in shared_source.distinct(username):
if i['link'] not in shared_viewer.distinct('link'):
add_link(i)
link = new_shared_list.canvas.text([0,share_count], text = str(i['link']), activefill = 'blue')
link.bind('<Double-1>', onObjectClick)
share_count -= 12
def onObjectClick(event):
"""
allows us to double click on a link and show it, as well as remove it from the list of need to view links
"""
global username
for thing in point_total.find():
for key in thing:
if key == username:
existing = thing[username]
point_total.update({username: existing}, {'$inc': {username:1}})
points.config(text = str(existing + 1))
index = event.widget.find_closest(event.x, event.y)
i = shared_viewer.find()
access = i[index[0] - 1]
link = access['link']
url_display(link)
shared_source.remove({username: {'link':access['link'], 'friend':access['friend']}})
#General set-up
pretty = 'light cyan'
gui = Gui()
gui.title('MusicswAPPer')
gui.row()
gui.la(text = 'Welcome to the swAPP', bg = 'black', fg='cyan', justify = 'left', font = ('Times', 20, 'bold italic'), height = 2, relief = 'groove')
gui.endrow()
gui.row(bg=pretty)
gui.col(bg=pretty)
gui.bu(text = 'Refresh', fg = 'forest green', font = ('Times', 15, 'bold'), bg=pretty, activeforeground='forest green', activebackground='powder blue', command = update)
gui.row([0,1], pady = 10, bg=pretty)
gui.endrow()
gui.la(text = 'Share a link', bg = pretty, font = ('Times', 13, 'italic'), anchor = 'left', justify='left')
friend = gui.en(text = 'Who do you want to share with?', disabledforeground = 'light gray', fg = 'black', font = ('Times', 12))
en = gui.en(text = 'Insert URL here', font = ('Times', 12))
gui.bu(text = 'Share', font = ('Times', 15, 'bold'), bg = pretty, fg = 'forest green', activebackground = 'powder blue', activeforeground = 'forest green', command = print_entry)
label = gui.la(bg=pretty, font=('Times', 11))
gui.row([0,1], pady = 10, bg=pretty)
gui.endrow()
gui.la(text = 'Share history', bg=pretty, font=('Times',13, 'italic'))
share_history = gui.sc(width = 500, height = 300)
share_history.canvas.configure(confine = False, scrollregion = (0,0,1000,1000))
gui.endcol()
gui.col(bg=pretty)
gui.ca(height = 100, width = 5, bg=pretty, bd=0)
gui.endcol()
gui.col(bg=pretty)
gui.ca(height = 10, width = 5, bg=pretty, bd=0)
gui.ca(height = 10, width = 5, bg='black',bd=0)
gui.ca(height = 10, width = 5, bg=pretty,bd=0)
gui.ca(height = 10, width = 5, bg='black',bd=0)
gui.ca(height = 10, width = 5, bg=pretty,bd=0)
gui.ca(height = 10, width = 5, bg='black',bd=0)
gui.ca(height = 10, width = 5, bg=pretty,bd=0)
gui.ca(height = 10, width = 5, bg='black',bd=0)
gui.ca(height = 10, width = 5, bg=pretty,bd=0)
gui.endcol()
gui.col(bg=pretty)
gui.ca(height = 100, width = 5, bg=pretty)
gui.endcol()
gui.col(bg=pretty)
gui.la(text = 'New Shares from Friends', bg = pretty, font=('Times', 13, 'italic'))
new_shared_list = gui.sc(width = 500, height = 100)
new_shared_list.canvas.configure(confine = False, scrollregion = (0,0,1000,1000))
gui.row([0,1], pady = 30, bg=pretty)
gui.endrow()
gui.la(text = 'Viewer', bg=pretty, font = ('Times', 13, 'italic'))
canvas = gui.ca(width = 500, height = 300, bg='black')
canvas.configure(confine = False, scrollregion = (0,0,2000, 2000))
points = gui.la(bg=pretty)
gui.endcol()
gui.col(bg=pretty)
gui.ca(height = 100, width = 5, bg=pretty)
gui.endcol()
gui.endrow()
initialize()
gui.mainloop()