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


Python Gui.gr方法代碼示例

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


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

示例1: Hwindow

# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import gr [as 別名]
class Hwindow():
	"""Creates host/join menu."""
	def __init__(self):
		self.h = Gui() # make h window
		self.h.title('Othello!')
		self.h.la(text='Game Name (no spaces)')
		self.entryField = self.h.en()
		self.h.gr(cols=2)
		hostButton = self.h.bu(text='Host Game', command=self.host)
		joinButton = self.h.bu(text='Join Game',command=self.join)
		self.h.mainloop()

	def host(self):
		"""Creates a game w/ 2 players and 2 computers."""
		name = self.entryField.get()
		data = {
				'gameName': name
		}

		req = urllib2.Request('http://othello.herokuapp.com/createGame')
		req.add_header('Content-Type', 'application/json')

		response = urllib2.urlopen(req, json.dumps(data))
		self.h.destroy() # close h window
		os.system('python board_piece_final_tweaked1.py ' + name + ' black')

	def join(self):
		"""Joins an existing game w/ 2 players and 2 computers."""

		name = self.entryField.get()
		self.h.destroy() # close h window
		os.system('python board_piece_final_tweaked1.py ' + name + ' white')
開發者ID:allisongpatterson,項目名稱:Othello,代碼行數:34,代碼來源:startup.py

示例2: Gwindow

# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import gr [as 別名]
class Gwindow(): 
	"""Creates local/internet menu."""
	def __init__(self):
		self.g = Gui() # make g window
		self.g.title('Othello!')
		self.g.gr(cols=2)
		localButton = self.g.bu(text='Local Game', command=self.local)
		internetButton = self.g.bu(text='Internet Game', command=self.internet)
		self.g.mainloop()

	def local(self):
		"""Creates a game w/ 2 players on 1 computer."""
		self.g.destroy() # close g window
		os.system('python board_piece_final_tweaked.py') # start local game

	def internet(self):
		"""Leads to next menu."""
		self.g.destroy() # close g window
		Hwindow()
開發者ID:allisongpatterson,項目名稱:Othello,代碼行數:21,代碼來源:startup.py

示例3: range

# 需要導入模塊: from swampy import Gui [as 別名]
# 或者: from swampy.Gui import gr [as 別名]
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()


# FRAME 5

# gr is for grid: start a grid with three columns
# the rweights control how extra space is divided among the rows
g.gr(3, rweights=[1, 1, 1])

for i in range(1, 10):
    g.bu(text=str(i))

g.endgr()


# FRAME 6

g.col()


def print_var(obj):
    print obj.var.get()
開發者ID:Ehsan1981,項目名稱:ThinkPython,代碼行數:32,代碼來源:widget_demo.py


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