當前位置: 首頁>>代碼示例>>Python>>正文


Python Gui.te方法代碼示例

本文整理匯總了Python中swampy.Gui.te方法的典型用法代碼示例。如果您正苦於以下問題:Python Gui.te方法的具體用法?Python Gui.te怎麽用?Python Gui.te使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在swampy.Gui的用法示例。


在下文中一共展示了Gui.te方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Gui

# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import te [as 別名]
from swampy.Gui import *
g = Gui()
g.title("Gui")


text = g.te(width=100, height=5)
canvas = g.ca(width=300, height=300)
canvas.config(bg='grey')
circle = None
def change_color():
    global circle
    color = entry.get()
    print color
    if circle == None:
        return
    circle.config(fill=color)

def draw_circle():
    global circle
    circle = canvas.circle([0, 0], 100, fill='red')

g.bu(text='create circle', command=draw_circle)
entry = g.en()
g.bu(text='change color', command=change_color)



g.mainloop()
開發者ID:venkateshwaracholan,項目名稱:Thinkpython,代碼行數:30,代碼來源:nineteen_three.py

示例2: range

# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import te [as 別名]
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
lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)


# FRAME 4

g.col()

# te is for text entry
te = g.te(height=5, width=40)
te.insert(END, "This is a Text widget.\n")
te.insert(END, "It's like a little text editor.\n")
te.insert(END, "It has more than one line, unlike an Entry widget.\n")

# st is for scrollable text
st = g.st()
st.text.configure(height=5, width=40)

st.text.insert(END, "This is a Scrollable Text widget.\n")
st.text.insert(END, "It is defined in Gui.py\n")

for i in range(100):
    st.text.insert(END, "All work and no play.\n")

g.endcol()
開發者ID:Ehsan1981,項目名稱:ThinkPython,代碼行數:33,代碼來源:widget_demo.py


注:本文中的swampy.Gui.te方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。