本文整理匯總了Python中swampy.Gui.sb方法的典型用法代碼示例。如果您正苦於以下問題:Python Gui.sb方法的具體用法?Python Gui.sb怎麽用?Python Gui.sb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類swampy.Gui
的用法示例。
在下文中一共展示了Gui.sb方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: figure8
# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import sb [as 別名]
def figure8():
print 'Figure 17.6'
g = Gui()
options = dict(side=TOP, fill=X)
# create the widgets
g.fr()
la = g.la(side=TOP, text='List of colors:')
lb = g.lb(side=LEFT)
sb = g.sb(side=RIGHT, fill=Y)
g.endfr()
bu = g.bu(side=BOTTOM, text='OK', command=g.quit)
# fill the listbox with color names
colors = []
for line in open('/etc/X11/rgb.txt'):
t = line.split('\t')
name = t[-1].strip()
colors.append(name)
for color in colors:
lb.insert(END, color)
# tell the listbox and the scrollbar about each other
lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)
g.mainloop()
g.destroy()
示例2: apply_color
# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import sb [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)