本文整理汇总了Python中Tkinter.Tk.config方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.config方法的具体用法?Python Tk.config怎么用?Python Tk.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_root
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def build_root():
ui_root = Tk()
# Build root drop-down menu and immediate child menus.
main_menu = Menu(ui_root)
file_submenu = Menu(main_menu, title="File")
settings_submenu = Menu(main_menu, title="Settings")
help_submenu = Menu(main_menu, title="Help")
# File
file_submenu.add_command(label="New Dataset...", command=dummy)
file_submenu.add_command(label="Open...", command=dummy)
file_submenu.add_command(label="Export...", command=dummy)
file_submenu.add_separator()
file_submenu.add_command(label="Quit", command=dummy)
# Settings
settings_submenu.add_command(label="PyNewhall Settings...", command=dummy)
# Help
help_submenu.add_command(label="About...", command=dummy)
help_submenu.add_command(label="Documentation...", command=dummy)
# Wrap up building main drop down menubar.
main_menu.add_cascade(label="File", menu=file_submenu)
main_menu.add_cascade(label="Settings", menu=settings_submenu)
main_menu.add_cascade(label="Help", menu=help_submenu)
ui_root.config(menu=main_menu)
ui_root.mainloop()
示例2: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
class GameGUI:
def __init__(self):
self.app = Tk()
self.app.title('Tic Tac Toe A.I')
self.app.resizable(width=False, height=False)
self.board = GameAI()
self.font = Font(family = "Arial", size = 28)
self.buttons = {}
for x,y in self.board.fields:
handler = lambda x = x, y = y: self.move(x,y)
button = Button(self.app, command = handler, font = self.font, width = 2,height = 1)
button.grid(row = y, column = x)
self.buttons[x,y] = button
handler = lambda: self.reset()
button = Button(self.app,text = 'reset',command = handler)
button.grid(row = self.board.dim+1, column = 0, columnspan = self.board.dim,sticky="WE")
self.quit = Button(self.app,text = 'quit', command = self.app.quit)
self.quit.grid(row = self.board.dim+2, column = 0, columnspan = self.board.dim,sticky="WE")
print "Dear Player, to mave a move click on any button and wait for A.I..."
def reset(self):
self.board = GameAI()
self.update()
def move(self,x,y):
self.app.config(cursor = "watch")
self.app.update()
self.board = self.board.move(x,y)
self.update()
move = self.board.best()
if move:
self.board = self.board.move(*move)
self.update()
self.app.config(cursor = "")
def update(self):
for (x,y) in self.board.fields:
text = self.board.fields[x,y]
self.buttons[x,y]['text'] = text
self.buttons[x,y]['disabledforeground'] = 'black'
if text == self.board.empty:
self.buttons[x,y]['state'] = 'normal'
else:
self.buttons[x,y]['state'] = 'disabled'
winning = self.board.won()
if winning:
for x,y in winning:
self.buttons[x,y]['disabledforeground'] = 'red'
for x,y in self.buttons:
self.buttons[x,y]['state']= 'disabled'
for (x,y) in self.board.fields:
self.buttons[x,y].update()
def mainloop(self):
self.app.mainloop()
示例3: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
class GUI:
def __init__(self):
self.app = Tk()
self.app.title('TicTacToe')
self.app.resizable(width=False, height=False)
self.board = Board()
self.font = Font(family="Helvetica", size=32)
self.buttons = {}
for x,y in self.board.fields:
handler = lambda x=x,y=y: self.move(x,y)
button = Button(self.app, command=handler, font=self.font, width=2, height=1)
button.grid(row=y, column=x)
self.buttons[x,y] = button
handler = lambda: self.reset()
button = Button(self.app, text='reset', command=handler)
button.grid(row=self.board.size+1, column=0, columnspan=self.board.size, sticky="WE")
self.update()
def reset(self):
self.board = Board()
self.update()
def move(self,x,y):
self.app.config(cursor="watch")
self.app.update()
self.board = self.board.move(x,y)
self.update()
move = self.board.best()
if move:
self.board = self.board.move(*move)
self.update()
self.app.config(cursor="")
def update(self):
for (x,y) in self.board.fields:
text = self.board.fields[x,y]
self.buttons[x,y]['text'] = text
self.buttons[x,y]['disabledforeground'] = 'black'
if text==self.board.empty:
self.buttons[x,y]['state'] = 'normal'
else:
self.buttons[x,y]['state'] = 'disabled'
winning = self.board.won()
if winning:
for x,y in winning:
self.buttons[x,y]['disabledforeground'] = 'red'
for x,y in self.buttons:
self.buttons[x,y]['state'] = 'disabled'
for (x,y) in self.board.fields:
self.buttons[x,y].update()
def mainloop(self):
self.app.mainloop()
示例4: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def __init__(self):
root = Tk()
root.title("split data")
root.geometry("200x200")
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="Load data",command = self.load_data)
self.notifcation = Label(root,text="")
self.notifcation.grid(row=0,column=0)
root.mainloop()
示例5: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
class GUI:
def __init__(self):
self.app = Tk()
self.app.title('War Game')
self.app.resizable(width=False, height=False)
self.font = Font(family="Helvetica", size=32)
self.buttons = {}
self.board = Board('./boards/Smolensk.txt')
self.size = SIZE
for y in xrange(1, self.size + 1):
for x in xrange(1, self.size + 1):
handler = lambda x=x, y=y: self.move(x, y)
button = Button(self.app, command=handler, font=self.font, width=3, height=1, text=self.board.values[y, x], background='gray')
button.grid(row=y, column=x)
self.buttons[x, y] = button
handler = lambda: self.auto_move()
button = Button(self.app, text='Start AI', command=handler)
button.grid(row=self.size + 1, column=1, columnspan=self.size, sticky="WE")
def auto_move(self):
while self.board.nodes_left > 0:
if self.board.player == 1:
cost, (y, x) = self.board.root_negalphabeta()
else:
cost, (y, x) = self.board.root_negalphabeta()
print 'Player: {} Heuristic {}'.format(self.board.player, cost)
self.move(x, y)
print 'Score: {}'.format(self.board.score)
def move(self, x, y):
self.app.config(cursor="watch")
self.app.update()
self.board.move(x, y)
self.update(x, y)
self.app.config(cursor="")
def update(self, x, y):
self.buttons[x, y]['state'] = 'disabled'
for y in xrange(1, self.size + 1):
for x in xrange(1, self.size + 1):
self.buttons[x, y]['background'] = COLORS[self.board.colors[y, x]]
self.buttons[x, y].update()
def mainloop(self):
self.app.mainloop()
示例6: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def __init__(self):
root = Tk()
root.title("Fractal Dimension")
root.geometry("200x200")
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="Load data",command = self.load_data)
self.ca=[]
max_size = 128
while max_size>0:
self.ca.append(CaGrid(max_size,max_size))
max_size = max_size/2
root.mainloop()
示例7: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def main():
note_sample_window_size = 75
training_time = 10
number_of_keys = 4
if len(sys.argv) > 1:
note_sample_window_size = int(sys.argv[1])
if len(sys.argv) > 2:
training_time = int(sys.argv[2])
if len(sys.argv) > 3:
number_of_keys = int(sys.argv[3])
# first, run the training function
(clf, mb) = train(note_sample_window_size, train_time_sec=training_time, n_keys=number_of_keys)
root = Tk()
root.geometry("1000x400")
MainWindow(root, clf, mb, note_sample_window_size)
menubar = Menu(root)
menubar.add_command(label="Quit", command=root.quit)
# display the menu
root.config(menu=menubar)
root.mainloop()
示例8: GameButton
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
currentMove = self.v
self.top.destroy()
class GameButton():
def __init__(self, i, master=None):
self.numara = i
self.satir = i / 3
self.sutun = i % 3
self.metin = StringVar()
self.metin.set("")
def clicked():
player(self.numara)
self.gorunum = Button(root, command=clicked, bg='gray', width=200, height=150, image=renksizAdam)
self.gorunum.grid(row=self.satir, column=self.sutun)
root = Tk()
root.wait_window(WhichColor(root).top)
root.title('XOX Graphical Interface')
menubar = Menu(root)
menubar.add_command(label="NEW GAME", command=startGame)
menubar.add_command(label="POINTS", command=points)
menubar.add_command(label="EXIT", command=root.quit)
root.config(menu=menubar)
renksizAdam = ImageTk.PhotoImage(file="RenksizAdam.png")
yesilAdam = ImageTk.PhotoImage(file="YesilAdam.png")
sariAdam = ImageTk.PhotoImage(file="SariAdam.png")
startGame()
mainloop()
示例9: MainApp
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
class MainApp(object):
"""
The MainApp based on TKinter
Attributes
----------
root : Tk
The Tk object
dbfdata : dictionary
The current dbf data
menubar : Menu
The menu bar
attibmenu : Menu
The attribute menu
"""
def __init__(self):
self.root = Tk()
self.root.geometry("300x250")
self.root.title("Shape file Reader")
self.createMenu()
self.root.mainloop()
def createMenu(self):
"""
Creates GUI components and register events
"""
self.menubar = Menu(self.root)
self.dbfdata = None
filemenu = Menu(self.menubar, tearoff=0)
filemenu.add_command(label="Open", command=self.__openShpfile)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=self.root.quit)
self.menubar.add_cascade(label="File", menu=filemenu)
self.attibmenu = Menu(self.menubar, tearoff=0)
self.menubar.add_cascade(label="Attibutes", menu=self.attibmenu,state='disabled')
#Sagar Jha
self.menubar.add_cascade(label="Simulator",command=self.__simulate)
#Added Simulator
self.root.config(menu=self.menubar)
def __simulate(self):
"""
This function will create object of SimulatorExperimence
"""
self.Sim = SimulatorExperimence()
## Test to check object type
## print(type(self.Sim))
self.Sim.doTest()
def __openShpfile(self):
"""
Open a shapefile and read in the contents, pop up the attribute menu
with the attributes of the shapefile
"""
print "open shape file!"
directory="C:/Users/sjha1/Documents/GitHub/Simulator_GUI/Python-Sample/data/states/48States.shp"
#tkFileDialog.askopenfilename(filetypes=[("SHAPE_FILE","*.shp")])
print directory
if directory == "":
return
self.shapes, self.shp_type, self.bbox = shp_reader.read_shp(directory)
#read corresponding dbf data
dbfFile = dbf.DbfLoader(directory[:-3] + "dbf")
t = dbfFile.table2list()
varNames = dbfFile.get_field_names()
variables = {}
for variable in varNames:
variables[variable] = [record[varNames.index(variable)] for record in t]
if self.dbfdata!=None:
self.attibmenu.delete(0, len(self.dbfdata)-1)
#add attributes into menu
for key in variables.keys():
self.__addAttribute(key)
self.dbfdata = variables
self.menubar.entryconfig(2, state=Tkconstants.NORMAL)
self.__updateCanvas("STATE_NAME")
def __addAttribute(self,attributeName):
"""
Add an attribute to the menu
"""
self.attibmenu.add_command(label=attributeName, command=lambda i=attributeName:self.__updateCanvas(i))
def __updateCanvas(self, attributeName):
"""
Updates the canvas and showing statistical information
"""
print "update Canvas "+attributeName
#.........这里部分代码省略.........
示例10: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def main():
Frecuenciadesampleo = 44100
MaxBits = 16
# Creacion de la ventana
ventana = Tk()
ventana.title("Ventana Principal")
ventana.config(bg = "black")
d = BooleanVar(ventana)
e = BooleanVar(ventana)
e.set(False)
f = BooleanVar(ventana)
f.set(False)
global arreglo1
arreglo1 = []
# Uso de frames para organizar la ventana.
frame1 = Frame(ventana,bg = "black")
frame1.pack(side=TOP)
frame2 = Frame(ventana,bg = "black")
frame2.pack(side=TOP)
frame3 = Frame(ventana,bg = "black")
frame3.pack(side=TOP)
frame4 = Frame(ventana,bg = "black")
frame4.pack(side=TOP)
frame5 = Frame(ventana,bg = "black")
frame5.pack(side=TOP)
def AbrirArchivo1():
d.set(True)
Abrir1()
mensaje1.pack(side=LEFT)
ReproButton1.pack(side=LEFT)
def AbrirArchivo2():
d.set(True)
Abrir2()
mensaje2.pack(side=LEFT)
ReproButton2.pack(side=LEFT)
def AbrirArchivo3():
d.set(True)
Abrir3()
mensaje3.pack(side=LEFT)
ReproButton3.pack(side=LEFT)
def AbrirArchivo4():
d.set(True)
Abrir4()
mensaje4.pack(side=LEFT)
ReproButton4.pack(side=LEFT)
def Reproducir1():
d.set(True)
reproduce1()
def Reproducir2():
d.set(True)
reproduce2()
def Reproducir3():
d.set(True)
reproduce3()
def Reproducir4():
d.set(True)
reproduce4()
def ReproducirMain():
d.set(True)
reproduce()
# Creacion de botones.
Titulo = Label(frame1, fg='red', padx=15, pady=10, text='Mixer Reproductor',bg = "black")
Titulo.pack(side=TOP)
Titulo1 = Label(frame1, fg='red', padx=15, pady=10, text='Luis Sandoval, Andres Palacio, Libardo Montealegre',bg = "black")
Titulo1.pack(side=TOP)
OpenButton1 = Button(frame1, padx=30, pady=2, text="Abrir Archivo 1", command=AbrirArchivo1,bg = "blue",fg="white")
OpenButton1.pack(side=LEFT)
OpenButton2 = Button(frame2, padx=30, pady=2, text="Abrir Archivo 2", command=AbrirArchivo2,bg = "blue",fg="white")
OpenButton2.pack(side=LEFT)
OpenButton3 = Button(frame3, padx=30, pady=2, text="Abrir Archivo 3", command=AbrirArchivo3,bg = "blue",fg="white")
OpenButton3.pack(side=LEFT)
OpenButton4 = Button(frame4, padx=30, pady=2, text="Abrir Archivo 4", command=AbrirArchivo4,bg = "blue",fg="white")
OpenButton4.pack(side=LEFT)
# Mensajes de grabacion activada.
mensaje1 = Label(frame1, fg='green', padx=15, pady=10, text='Archivo 1 Cargado',bg = "black")
#.........这里部分代码省略.........
示例11: PPEditor
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
#.........这里部分代码省略.........
stypemenu.add_command(label='HyperlinkShow', command = self.add_hyperlinkshow)
stypemenu.add_command(label='RadioButtonShow', command = self.add_radiobuttonshow)
stypemenu.add_command(label='ArtMediaShow', command = self.add_artmediashow)
stypemenu.add_command(label='ArtLiveShow', command = self.add_artliveshow)
showmenu.add_cascade(label='Add', menu = stypemenu)
medialistmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
menubar.add_cascade(label='MediaList', menu = medialistmenu)
medialistmenu.add_command(label='Add', command = self.add_medialist)
medialistmenu.add_command(label='Delete', command = self.remove_medialist)
medialistmenu.add_command(label='Copy To', command = self.copy_medialist)
trackmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
trackmenu.add_command(label='Delete', command = self.remove_track)
trackmenu.add_command(label='Edit', command = self.m_edit_track)
trackmenu.add_command(label='Add from Dir', command = self.add_tracks_from_dir)
trackmenu.add_command(label='Add from File', command = self.add_track_from_file)
menubar.add_cascade(label='Track', menu = trackmenu)
typemenu = Menu(trackmenu, tearoff=0, bg="grey", fg="black")
typemenu.add_command(label='Video', command = self.new_video_track)
typemenu.add_command(label='Audio', command = self.new_audio_track)
typemenu.add_command(label='Image', command = self.new_image_track)
typemenu.add_command(label='Web', command = self.new_web_track)
typemenu.add_command(label='Message', command = self.new_message_track)
typemenu.add_command(label='Show', command = self.new_show_track)
typemenu.add_command(label='Menu Track', command = self.new_menu_track)
trackmenu.add_cascade(label='New', menu = typemenu)
oscmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
menubar.add_cascade(label='OSC', menu = oscmenu)
oscmenu.add_command(label='Create OSC configuration', command = self.create_osc)
oscmenu.add_command(label='Edit OSC Configuration', command = self.edit_osc)
oscmenu.add_command(label='Delete OSC Configuration', command = self.delete_osc)
toolsmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
menubar.add_cascade(label='Tools', menu = toolsmenu)
toolsmenu.add_command(label='Update All', command = self.update_all)
optionsmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
menubar.add_cascade(label='Options', menu = optionsmenu)
optionsmenu.add_command(label='Edit', command = self.edit_options)
helpmenu = Menu(menubar, tearoff=0, bg="grey", fg="black")
menubar.add_cascade(label='Help', menu = helpmenu)
helpmenu.add_command(label='Help', command = self.show_help)
helpmenu.add_command(label='About', command = self.about)
self.root.config(menu=menubar)
top_frame=Frame(self.root)
top_frame.pack(side=TOP)
bottom_frame=Frame(self.root)
bottom_frame.pack(side=TOP, fill=BOTH, expand=1)
left_frame=Frame(bottom_frame, padx=5)
left_frame.pack(side=LEFT)
middle_frame=Frame(bottom_frame,padx=5)
middle_frame.pack(side=LEFT)
right_frame=Frame(bottom_frame,padx=5,pady=10)
right_frame.pack(side=LEFT)
updown_frame=Frame(bottom_frame,padx=5)
updown_frame.pack(side=LEFT)
示例12: PokerMachine
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
class PokerMachine():
"""Implements a video poker machine class."""
def __init__(self):
"""Instance initialization function."""
# Set up variables
self.deck = pcards.Deck()
self.cardimg = []
self.hand = None
self.game_start = True
self.game_postdeal = False
self.game_easy = True
self.game_over = False
self.gifdir = "./images/"
self.pot = 100
self.defaultbet = 5
self.bet = 5
self._set_up_gui()
def button_clicked(self):
"""Event handler for button click.
Callback method called by tk.
"""
if self.game_over:
self._start_new_game()
elif not self.game_postdeal:
self._process_bet()
elif self.game_postdeal:
self._evaluate_hand()
def flip(self, event):
"""Event handler which flips a clicked card.
Callback method called by tk.
"""
if not self.game_postdeal:
return
if event.widget.flipped:
event.widget.flipped = False
event.widget.configure(image=event.widget.cardimage)
else:
event.widget.flipped = True
event.widget.configure(image=self.backimg)
def _start_new_game(self):
"""Returns the game an interface to its starting point."""
for cardimg in self.cardimg:
cardimg.configure(image=self.backimg)
cardimg.flipped = True
self.game_over = False
self.game_postdeal = False
self.pot = 100
self.defaultbet = 5
self.bet = 5
self._update_pot()
self.bet_amt_fld.configure(state=NORMAL)
self.bet_str.set(str(self.defaultbet))
self.button.configure(text="Deal")
self.status_lbl.configure(text="Click 'Deal' to play.")
def _process_bet(self):
"""Processes the player's bet and deals a new hand
if the bet is valid.
"""
# First check if played made a valid bet,
# and return with no change in state (other
# than resetting the bet field) if they did
# not.
b_str = self.bet_str.get()
try:
self.bet = int(b_str)
except ValueError:
self._show_bet_error("Bad bet!", "You must bet a whole number!")
return
if self.bet > self.pot:
self._show_bet_error("Don't be greedy!",
#.........这里部分代码省略.........
示例13: Compresor4
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def Compresor4():
compresor=Tk()
compresor.title("Compresor 4 ")
compresor.config(bg = "black")
# Uso de frames para organizar la ventana.
frame1 = Frame(compresor,bg = "black")
frame1.pack(side=TOP)
global Array4, ArrayComprimido4
def compresoraudio4():
NivelThresh=Threshold.get()
Thresh1 = (10**float(NivelThresh/20))*((2**16)/2.0)
Attack1=float(Attack.get()/1000.0)
CuadrosAttack=int(Attack1*44100)
ratio=Ratio.get()
Knee=float((ratio-1)/CuadrosAttack)
ArregloAttack=[]
for j in range(1, CuadrosAttack):
Dato1=1+float(Knee*j)
ArregloAttack.append(Dato1)
for i in range(0, len(Array4)):
if Array4[i][0]>Thresh1:
if i<CuadrosAttack:
c=Array4[i][0]-Thresh1
k=float(c/ArregloAttack[i])
Amp=k+Thresh1
if i >CuadrosAttack:
c=Array4[i][0]-Thresh1
k=float(c/ratio)
Amp=k+Thresh1
if Array4[i][0]<(Thresh1*(-1)):
if i<CuadrosAttack:
c=Array4[i][0]-Thresh1
k=float(c/ArregloAttack[i])
Amp=k+Thresh1
if i >CuadrosAttack:
c=Array4[i][0]-Thresh1
k=float(c/ratio)
Amp=k+Thresh1
else:
Amp=Array4[i][0]
ArrayComprimido4.append(Amp)
Label1= Label(frame1, padx=15, pady=1, text="Compresor 1",fg = "white",bg = "black")
Label1.pack(side=TOP)
espacio2= Label(frame1, padx=15, pady=1, text=" ",fg = "white",bg = "black")
espacio2.pack(side=TOP)
#threshold
Label2= Label(frame1, padx=15, pady=1, text="Threshold",fg = "white",bg = "black")
Label2.pack(side=TOP)
Threshold= Scale(frame1, orient=HORIZONTAL,width=10, length=250,from_=-60,to=0,bg = "yellow", fg="black")
Threshold.pack(side=TOP)
#ratio
Label3= Label(frame1, padx=15, pady=1, text="Ratio",fg = "white",bg = "black")
Label3.pack(side=TOP)
Ratio=Scale(frame1, orient=HORIZONTAL,width=10, length=250,from_=9,to=0,bg = "blue", fg="white")
Ratio.pack(side=TOP)
#attack
Label4= Label(frame1, padx=15, pady=1, text="Attack",fg = "white",bg = "black")
Label4.pack(side=TOP)
Attack=Scale(frame1, orient=HORIZONTAL,width=10, length=250,from_=50,to=500,bg = "red", fg="white")
Attack.pack(side=TOP)
#realease
Label5= Label(frame1, padx=15, pady=1, text="Release",fg = "white",bg = "black")
Label5.pack(side=TOP)
Release=Scale(frame1, orient=HORIZONTAL,width=10, length=250,from_=4000,to=5,fg = "white",bg = "black")
Release.pack(side=TOP)
#gain
Label6= Label(frame1, padx=15, pady=1, text="Gain",fg = "white",bg = "black")
Label6.pack(side=TOP)
Gain=Scale(frame1, orient=HORIZONTAL,width=10, length=250,from_=40,to=0,bg = "white", fg="black")
Gain.pack(side=TOP)
espacio1= Label(frame1, padx=15, pady=1, text=" ",fg = "white",bg = "black")
espacio1.pack(side=TOP)
# Comprimir
ComprimirButton1 = Button(frame1, padx=30, pady=2, text="Comprimir",bg = "red",fg="white",command= compresoraudio4)
ComprimirButton1.pack(side=TOP)
compresor.mainloop()
示例14: Main1
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
def Main1():
global reproducir
reproducir=0
# Creacion de la ventana
ventana = Tk()
ventana.title("Proyecto Final")
ventana.config(bg = "black")
d = BooleanVar(ventana)
e = BooleanVar(ventana)
e.set(False)
f = BooleanVar(ventana)
f.set(False)
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
audio1 = Grabador1(CHUNK, FORMAT, CHANNELS, RATE)
audio2 = Grabador2(CHUNK, FORMAT, CHANNELS, RATE)
audio3 = Grabador3(CHUNK, FORMAT, CHANNELS, RATE)
audio4 = Grabador4(CHUNK, FORMAT, CHANNELS, RATE)
global Array1,Array2,Array3,Array4
global Rec1,Rec2,Rec3,Rec4
global ArrayFinal1,ArrayFinal2,ArrayFinal3,ArrayFinal4
global ArrayComprimido1, ArrayComprimido2, ArrayComprimido3, ArrayComprimido4
global FinalArray1,FinalArray2,FinalArray3,FinalArray4
global MezclaFinalFinal,MezclaMixFinal
global FinalArrayAux1,FinalArrayAux2,FinalArrayAux3,FinalArrayAux4
global MezclaAUXFINAL, MezclaMixAux
# Arreglos globales
Array1 = []
Array2 = []
Array3 = []
Array4 = []
#Los de la grabacion
Rec1 = []
Rec2 = []
Rec3 = []
Rec4 = []
#Arreglos comprimidos del Audio
ArrayComprimido1= []
ArrayComprimido2= []
ArrayComprimido3= []
ArrayComprimido4= []
# Arreglos finales antes del fader
ArrayFinal1 = []
ArrayFinal2 = []
ArrayFinal3 = []
ArrayFinal4 = []
# Arreglos finales antes del fader
FinalArray1= []
FinalArray2= []
FinalArray3= []
FinalArray4= []
MezclaFinalFinal= []
MezclaMixFinal = []
#Arreglos de envio de AUX
FinalArrayAux1 = []
FinalArrayAux2 = []
FinalArrayAux3 = []
FinalArrayAux4 = []
MezclaAUXFINAL = []
MezclaMixAux = []
audiocom1=BooleanVar(ventana)
audiocom1.set(False)
# Uso de frames para organizar la ventana.
frame1 = Frame(ventana,bg = "black")
frame1.pack(side=TOP)
frame2 = Frame(ventana,bg = "black")
frame2.pack(side=LEFT)
frame3 = Frame(ventana,bg = "black")
frame3.pack(side=LEFT)
frame4 = Frame(ventana,bg = "black")
frame4.pack(side=LEFT)
frame5 = Frame(ventana,bg = "black")
frame5.pack(side=LEFT)
frame6 = Frame(ventana,bg = "black")
frame6.pack(side=LEFT)
frame7 = Frame(ventana,bg = "black")
frame7.pack(side=LEFT)
#.........这里部分代码省略.........
示例15: init_troop
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import config [as 别名]
#.........这里部分代码省略.........
weapons = [random.choice(nation.ranged_weapon_list), random.choice(nation.sidearm_list)]
else:
weapons = [random.choice(nation.weapon_list), random.choice(nation.sidearm_list)]
armor = random.choice(nation.armor_list)
mount = nation.mount_none
if random.randint(0, 100) < (self.elite * 2) + 5:
mount = random.choice(nation.mount_list)
self.weapons = weapons
self.armor = armor
self.mount = mount
self.arms_history.append((self.weapons, self.armor, self.mount))
self.stats_history.append(utility.base_soldier_stats())
return self
def rearm(self, name, new_weapons, new_armor, new_mount):
if self.name == name:
self.weapons = new_weapons
self.armor = new_armor
self.mount = new_mount
else:
for upgrade in self.upgrades:
upgrade.rearm(name, new_weapons, new_armor, new_mount)
def show_information_gui(self):
self.gui_window = Tk()
self.gui_window.title(self.name)
self.gui_window.geometry("400x625+0+0")
self.gui_window.config(background='white')
self.ranged_label = gui.Label(self.gui_window, text='Is ranged: {}'.format(self.ranged))
self.ranged_label.grid(row=0, sticky=W)
self.mount_label = gui.Label(self.gui_window, text='Mount: {}'.format(self.mount.name))
self.mount_label.grid(row=1, sticky=W)
self.strength_label = gui.Label(self.gui_window, text='Strength: {}'.format(self.strength))
self.strength_label.grid(row=2, sticky=W)
self.health_label = gui.Label(self.gui_window, text='Health: {}'.format(self.health))
self.health_label.grid(row=3, sticky=W)
self.discipline_label = gui.Label(self.gui_window, text='Discipline: {}'.format(self.discipline))
self.discipline_label.grid(row=4, sticky=W)
self.discipline_label = gui.Label(self.gui_window, text='Cost: {}'.format(self.get_soldier_cost()))
self.discipline_label.grid(row=5, sticky=W)
self.arrangement = gui.Label(self.gui_window, text='Arrangement: {}x{}'.format(self.rank_size, self.ranks))
self.arrangement.grid(row=6, sticky=W)
self.arrangement_canvas = Canvas(self.gui_window, width = (self.rank_size + 1) * (TROOP_RADIUS + 1), height= (self.ranks + 1) * (TROOP_RADIUS + 1))
self.arrangement_canvas.config(background='white')
self.arrangement_canvas.grid(row=7, sticky=W)
for x in xrange(1, self.rank_size + 1):
for y in xrange(1, self.ranks + 1):
base_x, base_y = x * (TROOP_RADIUS + 1), y * (TROOP_RADIUS + 1)
self.arrangement_canvas.create_oval(base_x, base_y, base_x + TROOP_RADIUS, base_y + TROOP_RADIUS)