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


Python GUI.newPlayField方法代碼示例

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


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

示例1: gui

# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import newPlayField [as 別名]
def gui():
    global c,root
    root=TK.Tk()
    c,l=GUI.newPlayField(32*x,32*y,x,y,root,"black",("<Button-1>",))
    c.grid(column=0,row=0)
    menueFrame=TK.Frame(root)
    TowerFrame=TK.Frame(menueFrame)
    TK.Button(TowerFrame,text="T1",command=lambda:setTID(1)).grid(column=0,row=0)
    TK.Button(TowerFrame,text="T2",command=lambda:setTID(2)).grid(column=1,row=0)
    TK.Button(TowerFrame,text="T3",command=lambda:setTID(3)).grid(column=2,row=0)
    TK.Button(TowerFrame,text="T4",command=lambda:setTID(4)).grid(column=0,row=1)
    TK.Button(TowerFrame,text="T5",command=lambda:setTID(5)).grid(column=1,row=1)
    TK.Button(TowerFrame,text="T6",command=lambda:setTID(6)).grid(column=2,row=1)
    TK.Button(TowerFrame,text="T7",command=lambda:setTID(7)).grid(column=0,row=2)
    TK.Button(TowerFrame,text="T8",command=lambda:setTID(8)).grid(column=1,row=2)
    TK.Button(TowerFrame,text="T9",command=lambda:setTID(9)).grid(column=2,row=2)
    TowerFrame.pack(side=TK.TOP)
    menueFrame.grid(column=1,row=0,sticky=TK.N)
    root.mainloop()
開發者ID:FLJoergensen,項目名稱:PyGame2DTkinter,代碼行數:21,代碼來源:GAMETowerDefv1.py

示例2: gui

# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import newPlayField [as 別名]
def gui():
    global c,root
    root=TK.Tk()
    fc=TK.Frame(root).grid(column=0,row=0)
    f=TK.Frame(root).grid(column=1,row=0)
    c,l=GUI.newPlayField(32*x,32*y,x,y,fc,"black",("<Button-1>",))
    #scrolbar
    hbar=TK.Scrollbar(fc,orient=TK.HORIZONTAL)
    hbar.pack(side=TK.BOTTOM,fill=TK.X)
    hbar.config(command=c.xview)
    vbar=TK.Scrollbar(fc,orient=TK.VERTICAL)
    vbar.pack(side=TK.RIGHT,fill=TK.Y)
    vbar.config(command=c.yview)
    c.pack()
    c.config(width=32*10,height=32*10)
    c.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set)
    c.pack(side=TK.LEFT,expand=True,fill=TK.BOTH)
    #end
    thread.start_new(root.mainloop,())
    #c.config(width=32*10,height=32*10)
    pass
開發者ID:FLJoergensen,項目名稱:PyGame2DTkinter,代碼行數:23,代碼來源:GAMETowerDefv1.py

示例3:

# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import newPlayField [as 別名]
import Tkinter as TK
import GUI
import EDITOR

root=TK.Tk()
c,l=GUI.newPlayField(1000,1000,20,20,root,"black",("<Button-1>",))
for item in l:
    item.clickList.append(EDITOR.P)
c.pack()
root.mainloop()
開發者ID:FLJoergensen,項目名稱:PyGame2DTkinter,代碼行數:12,代碼來源:t2.py

示例4: CreatEditor

# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import newPlayField [as 別名]

#.........這裏部分代碼省略.........
                imgID=c.create_image(x,y,anchor=TK.CENTER,image=img)
                if gf.Layer[viewLayer]!=None:
                    c.delete(gf.Layer[viewLayer][1])
                gf.Layer[viewLayer]=(imgaccstr,imgID)
                pass
            if viewLayer=="blocked":
                gf.Layer[viewLayer]=True
            pass
        if e.num==3 or e.state==1032:
            if gf.Layer.has_key(viewLayer) and viewLayer!=None and viewLayer!="blocked":
                if gf.Layer[viewLayer]!=None:
                    c.delete(gf.Layer[viewLayer][1])
                gf.Layer[viewLayer]=None
                pass
            if viewLayer=="blocked":
                gf.Layer[viewLayer]=False
            pass
        pass
    def changeBind(b):
        global binded
        if not b:
            c.bind("<0>",lambda x:setLayer(0))
            c.bind("<1>",lambda x:setLayer(1))
            c.bind("<2>",lambda x:setLayer(2))
            c.bind("<3>",lambda x:setLayer(3))
            c.bind("<4>",lambda x:setLayer(4))
            c.bind("<5>",lambda x:setLayer(5))
            c.bind("<6>",lambda x:setLayer(6))
            c.bind("<7>",lambda x:setLayer(7))
            c.bind("<8>",lambda x:setLayer(8))
            c.bind("<9>",lambda x:setLayer(9))
        else:
            tempBindList=("<0>","<1>","<2>","<3>","<4>","<5>","<6>","<7>","<8>","<9>")
            for item in tempBindList:
                c.unbind(item)
        binded=b
    #World
    basicWorld=E.World(WSteps,HSteps,E.GUIField())
    #World END
    uclock=HF.Clock(0.5)
    uclock.addFunc(lambda x:PP("Update"))
    uclock.addFunc(lambda x:changeLayer(viewLayer))
    root=TK.Tk()
    root.title("Editor")
    #root.bind("<Alt-u>",lambda x: uclock.ActivChange())
    root.bind("<Control-s>",lambda x: SaveMap())
    root.bind("<Control-l>",lambda x: LoadMap())
    c,l=GUI.newPlayField(W,H,WSteps,HSteps,root,"#777777",("<Button-1>","<B1-Motion>","<Button-3>","<B3-Motion>"))
    for item in l:
        item.clickList.append(CreateDrawCanvas)
    c.bind("<Enter>",loadingImageIn)
    c.bind("<F5>",lambda x:changeLayer(viewLayer))
    c.bind("<F6>",lambda x:changeLayer("combo"))
    #c.bind("<F7>",lambda x:changeBind(not binded))
    binded=True
    #c.bind("<0>",lambda x:setLayer(0))
    #c.bind("<1>",lambda x:setLayer(1))
    #c.bind("<2>",lambda x:setLayer(2))
    #c.bind("<3>",lambda x:setLayer(3))
    #c.bind("<4>",lambda x:setLayer(4))
    #c.bind("<5>",lambda x:setLayer(5))
    #c.bind("<6>",lambda x:setLayer(6))
    #c.bind("<7>",lambda x:setLayer(7))
    #c.bind("<8>",lambda x:setLayer(8))
    #c.bind("<9>",lambda x:setLayer(9))
    c.grid(row=0,column=0)
    #load Images
    width=W/WSteps#1000/20
    height=H/HSteps#1000/20
    imgdic,il=HF.getSizedAllImages(width,height)
    #load Images END
    f=TK.Frame(root)
    f.grid(row=0,column=1)
    TK.Label(f,text="Label Selection").pack()
    TK.Button(f,text="None",command=lambda:setLayer(None)).pack()
    TK.Button(f,text="block",command=lambda:setLayer("blocked")).pack()
    TK.Button(f,text=str(0),command=lambda:setLayer(0)).pack()
    TK.Button(f,text=str(1),command=lambda:setLayer(1)).pack()
    TK.Button(f,text=str(2),command=lambda:setLayer(2)).pack()
    TK.Button(f,text=str(3),command=lambda:setLayer(3)).pack()
    TK.Button(f,text=str(4),command=lambda:setLayer(4)).pack()
    TK.Button(f,text=str(5),command=lambda:setLayer(5)).pack()
    TK.Button(f,text=str(6),command=lambda:setLayer(6)).pack()
    TK.Button(f,text=str(7),command=lambda:setLayer(7)).pack()
    TK.Button(f,text=str(8),command=lambda:setLayer(8)).pack()
    TK.Button(f,text=str(9),command=lambda:setLayer(9)).pack()
    #section pic select
    TK.Label(f,text="Texture Selection").pack()
    #TK.Button(f,text="Load Image",command=loadimg).pack()
    #TK.Button(f,text="None",command=loadimg).pack()
    #TK.Button(f,text="Image",command=loadimg).pack()
    #TK.Button(f,text="Color",command=loadimg).pack()
    ListB=TK.Listbox(f,width=50)
    #ListB.insert(0,HF.ErrorImage)
    for item in il:
        #print item
        ListB.insert(0,item)
    ListB.select_set(0)
    ListB.pack()
    root.mainloop()
開發者ID:FLJoergensen,項目名稱:PyGame2DTkinter,代碼行數:104,代碼來源:main.py


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