本文整理汇总了Python中tkinter.Scale类的典型用法代码示例。如果您正苦于以下问题:Python Scale类的具体用法?Python Scale怎么用?Python Scale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Scale类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Tx
class Tx(Tk.Frame):
def __init__(self, master=None):
Tk.Frame.__init__(self, master)
self.tx_frame = Tk.Frame(self)
self.gpio = []
for i in range(0,20):
self.gpio.append(GPIO(i))
# GPIO LABEL
self.gpio_hdr = Tk.Label(self.tx_frame,text="PORT%02d"%i, anchor=Tk.W)
# GPIO Configure
self.c_gpio_config = ttk.Combobox(self.tx_frame,value=["INPUT","OUTPUT","HIZ"], state="readonly")
self.c_gpio_config.current(HIZ)
self.c_gpio_config.bind("<<ComboboxSelected>>",self.gpio[i].config_change)
self.gpio[i].set_combo(self.c_gpio_config)
# GPIO scaler
self.s_gpio_value = Scale(self.tx_frame,orient = 'h',showvalue = 0,from_ = 0, to = 1,command = self.gpio[i].value_change)
self.gpio[i].set_scale(self.s_gpio_value)
self.gpio_hdr.grid(row=i, column=0, padx=5, pady=0)
self.c_gpio_config.grid(row=i, column=1, padx=5, pady=0)
self.s_gpio_value.grid(row=i, column=2, padx=5, pady=0)
self.tx_frame.pack()
开发者ID:LAPIS-Lazurite,项目名称:RohmSensorShieldDemo,代码行数:25,代码来源:gw_sensor.py
示例2: create_monitor
def create_monitor(self):
self.monitor_frame = LabelFrame(self, text="Monitor and Transport")
this_cycle = Scale(self.monitor_frame, label='cycle_pos', orient=HORIZONTAL,
from_=1, to=16, resolution=1)
this_cycle.disable, this_cycle.enable = (None, None)
this_cycle.ref = 'cycle_pos'
this_cycle.grid(column=0, row=0, sticky=E + W)
self.updateButton = Button(self.monitor_frame,
text='Reload all Settings',
command=self.request_update)
self.updateButton.grid(row=1, sticky=E + W)
self.ForceCaesuraButton = Button(self.monitor_frame,
text='Force Caesura',
command=self.force_caesura)
self.ForceCaesuraButton.grid(row=2, sticky=E + W)
self.saveBehaviourButton = Button(self.monitor_frame,
text='Save current behaviour',
command=self.request_saving_behaviour)
self.saveBehaviourButton.grid(row=3, sticky=E + W)
self.saveBehaviourNameEntry = Entry(self.monitor_frame)
self.saveBehaviourNameEntry.grid(row=4, sticky=E + W)
self.saveBehaviourNameEntry.bind('<KeyRelease>', self.request_saving_behaviour)
self.selected_behaviour = StringVar()
self.selected_behaviour.trace('w', self.new_behaviour_chosen)
self.savedBehavioursMenu = OptionMenu(self.monitor_frame,
self.selected_behaviour, None,)
self.savedBehavioursMenu.grid(row=5, sticky=E + W)
self.monitor_frame.grid(column=0, row=10, sticky=E + W)
开发者ID:kr1,项目名称:roqba,代码行数:28,代码来源:main.py
示例3: create_ranges
def create_ranges(self):
counter = 0
for ran in RANGES:
setattr(self, 'min_' + ran, RANGES[ran]['min'])
setattr(self, 'max_' + ran, RANGES[ran]['max'])
self.this_min_scale = Scale(self, label='min ' + ran, orient=HORIZONTAL,
from_=getattr(self, 'min_' + ran),
to=getattr(self, 'max_' + ran),
resolution=RANGES[ran]['res'])
self.this_max_scale = Scale(self, label='max ' + ran, orient=HORIZONTAL,
from_=getattr(self, 'min_' + ran),
to=getattr(self, 'max_' + ran),
resolution=RANGES[ran]['res'])
self.this_min_scale.set(RANGES[ran]['min_start'])
self.this_max_scale.set(RANGES[ran]['max_start'])
self.this_min_scale.enable = ('enable' in list(RANGES[ran].keys()) and
RANGES[ran]['enable'] or None)
self.this_min_scale.disable = ('disable' in list(RANGES[ran].keys()) and
RANGES[ran]['disable'] or None)
self.this_max_scale.enable = ('enable' in list(RANGES[ran].keys()) and
RANGES[ran]['enable'] or None)
self.this_max_scale.disable = ('disable' in list(RANGES[ran].keys()) and
RANGES[ran]['disable'] or None)
self.this_min_scale.grid(column=2, row=counter, sticky=E + W)
self.this_max_scale.grid(column=2, row=counter + 1, sticky=E + W)
self.this_min_scale.ref = 'min_' + ran
self.this_max_scale.ref = 'max_' + ran
self.this_min_scale.bind("<ButtonRelease>", self.scale_handler)
self.this_max_scale.bind("<ButtonRelease>", self.scale_handler)
counter += 2
开发者ID:kr1,项目名称:roqba,代码行数:30,代码来源:main.py
示例4: __init__
def __init__(self, master, image, name, enhancer, lo, hi):
Frame.__init__(self, master)
# set up the image
self.tkim = ImageTk.PhotoImage(image.mode, image.size)
self.enhancer = enhancer(image)
self.update("1.0") # normalize
# image window
Label(self, image=self.tkim).pack()
# scale
s = Scale(self, label=name, orient=HORIZONTAL, from_=lo, to=hi, resolution=0.01, command=self.update)
s.set(self.value)
s.pack()
开发者ID:eshantewari,项目名称:MBHS_SGA,代码行数:15,代码来源:enhancer.py
示例5: create_scales
def create_scales(self):
counter = 0
for sca in SCALES:
label = SCALES[sca]['label'] if 'label' in list(SCALES[sca].keys()) else sca
setattr(self, 'min_' + sca, SCALES[sca]['min'])
setattr(self, 'max_' + sca, SCALES[sca]['max'])
self.this_scale = Scale(self, label=label, orient=HORIZONTAL,
from_=getattr(self, 'min_' + sca),
to=getattr(self, 'max_' + sca),
resolution=SCALES[sca]['res'])
self.this_scale.set(SCALES[sca]['start'])
self.this_scale.enable = ('enable' in list(SCALES[sca].keys()) and
SCALES[sca]['enable'] or None)
self.this_scale.disable = ('disable' in list(SCALES[sca].keys()) and
SCALES[sca]['disable'] or None)
if 'pos' in list(SCALES[sca].keys()):
pos = SCALES[sca]['pos']
col = pos['c']
row = pos['r']
else:
row = counter
col = 1
counter += 1
self.this_scale.grid(column=col, row=row, sticky=E + W)
self.this_scale.ref = sca
self.this_scale.bind("<ButtonRelease>", self.scale_handler)
开发者ID:kr1,项目名称:roqba,代码行数:26,代码来源:main.py
示例6: __init__
def __init__(self, master, image, image_name):
Frame.__init__(self, master)
self.image = image
self.image_name = image_name
# make a blank image for the text, initialized to transparent text color
self.blank_image = Image.new('RGBA', self.image.size, (255,255,255,0))
self.fnt = ImageFont.truetype('fonts/MontereyFLF.ttf', 50)
self.d = ImageDraw.Draw(self.blank_image)
#default watermark
self.name = "watermark"
self.loc_x = 0
self.loc_y = 225
self.rgbo = (0,0,0,200)
self.d.text((self.loc_x, self.loc_y), self.name, font=self.fnt, fill=self.rgbo)
self.out = Image.alpha_composite(self.image, self.blank_image)
self.tkim = ImageTk.PhotoImage(self.out)
#display image
Label(root, image=self.tkim).pack()
# opacity scale
s_opacity = Scale(self, label="Opacity", orient=HORIZONTAL, from_=0, to=255, resolution=1, command=self.update_opacity)
s_opacity.set(200)
s_opacity.pack(pady = 10)
#update text
self.textbox = Entry()
self.textbox.pack(pady = 10)
b_text = Button(master, text="update text", command=self.update_text)
b_text.pack()
b_color = Button(master, text="black/white", command=self.update_color)
b_color.pack()
b_save = Button(master, text="save image", command=self.save_image)
b_save.pack()
开发者ID:shivmalhotra,项目名称:watermark-generator,代码行数:40,代码来源:watermark.py
示例7: main
def main():
window = Tk()
# window.iconbitmap('Nik.ico')
window.title('Селезнев Никита, ФИИТ-401')
window.resizable(width=False, height=False)
color1 = 'PaleGoldenrod'
color2 = 'lightyellow'
frame = Frame(window, bg=color1)
frame.pack()
Label(frame, text="Лабораторная работа №2.\n14 вариант.",
justify=CENTER, font=("Helvetica", 12), bd=10, bg=color1).pack()
Label(frame, text="""f(x) = y + Lx(1-x) + 2L + 2, L = 3.3,\ty0 = 0
Решение численными методами
1) Эйлера (явный)
2) Эйлера (с пересчётом)
3) Рунге-Кутта
4) Прогонка
а также точное решение.""", justify=LEFT, font=("Helvetica", 12), bd=10, bg=color2).pack()
Label(frame, text="\nВыберите количество точек:", justify=CENTER, font=("Helvetica", 12), bd=0, bg=color1).pack()
w = Scale(frame, from_=5, to=500, resolution=1, length=300, bg=color1, borderwidth=0,
relief=GROOVE, orient=HORIZONTAL, highlightthickness=0)
w.pack()
Label(frame, text='\n', bg=color1).pack()
Button(frame, text="Нарисовать график",
font=("Helvetica", 12),
bg=color2,
command=lambda: draw_all(int(w.get()))).pack()
window.mainloop()
开发者ID:neseleznev,项目名称:urfu-CompExp,代码行数:36,代码来源:lab5.py
示例8: createWidgets
def createWidgets(self):
Label(self.root, text="Value:").grid(row=0, sticky=W)
Label(self.root, text="H:").grid(row=1, sticky=W)
Label(self.root, text="S:").grid(row=2, sticky=W)
Label(self.root, text="V:").grid(row=3, sticky=W)
Label(self.root, text="S:").grid(row=4, sticky=W)
Label(self.root, text="V:").grid(row=5, sticky=W)
Label(self.root, text="H:").grid(row=6, sticky=W)
self.valueLabel = Label(self.root, text="000-000-000 to 000-000-000")
self.valueLabel.grid(row=0, column=1, sticky=W)
self.Hvalue = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.Hvalue.grid(row=1, column=1)
self.Hvalue.set(0)
self.Svalue = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.Svalue.grid( row=2, column=1)
self.Svalue.set(90)
self.Vvalue = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.Vvalue.grid( row=3, column=1)
self.Vvalue.set(0)
self.HvalueMax = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.HvalueMax.grid(row=4, column=1)
self.HvalueMax.set(255)
self.SvalueMax = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.SvalueMax.grid(row=5, column=1)
self.SvalueMax.set(255)
self.VvalueMax = Scale(self.root, from_=0, to=255, orient=HORIZONTAL, command=self.__sliderCallback)
self.VvalueMax.grid(row=6, column=1)
self.VvalueMax.set(120)
self.Go = tk.Button(self.root, text="Go!", fg="Green", command=self.Funkify)
self.Go.grid(row=7, column=0)
self.QUIT = tk.Button(self.root, text="QUIT", fg="red", command=self.root.destroy)
self.QUIT.grid(row=7, column=1)
开发者ID:AlbertoBonfiglio,项目名称:Me599,代码行数:45,代码来源:hsv_gui.py
示例9: __init__
#.........这里部分代码省略.........
self.var_subsec[t] = [tk.StringVar(fr)]
if u in OPTIONS:
dd_subsec[t] = [OptionMenu(fr, self.var_subsec[t][-1], *OPTIONS[u])]
else:
dd_subsec[t] = [""]
except KeyError as e:
print(e)
dd_subsec[t].append("")
for t in lab_subsec:
r = 0
c = 0
for i in lab_subsec[t]:
print(i.cget("text"))
i.grid(row=r, column=c, sticky=tk.E)
r += 1
print(r, i.cget("text"))
for t in dd_subsec:
c = 1
r = 0
for i in dd_subsec[t]:
print(i)
if i is not "":
i.grid(row=r, column=c, sticky=tk.N)
r += 1
print(r)
######################################
self.st_submat = tk.StringVar()
# self.st_outpref = tk.StringVar()
# self.st_spliteach = tk.StringVar()
self.st_fasta_header_delimiter = tk.StringVar()
self.st_fasta_header_part = tk.StringVar()
self.sc_config_numthreads = Scale(fr_run, from_=1, to=multiprocessing.cpu_count(), orient=tk.HORIZONTAL)
self.sc_config_numthreads.grid(row=0, column=1, sticky=tk.E)
en_config_gapopen = tk.Entry(fr_penalties, textvariable=self.var_subsec[CF_PENALTIES][0])
en_config_gapextend = tk.Entry(fr_penalties, textvariable=self.var_subsec[CF_PENALTIES][1])
# self.en_config_spliteach=tk.Entry(fr_run,textvariable=self.st_spliteach,width=6 )
self.en_config_fasta_header_delimiter = tk.Entry(
fr_fastaheader, textvariable=self.st_fasta_header_delimiter, width=6
)
self.en_config_fasta_header_part = tk.Entry(fr_fastaheader, textvariable=self.st_fasta_header_part, width=6)
self.om_config_submat = tk.OptionMenu(fr_penalties, self.st_submat, *["EBLOSUM62", "EDNAFULL"])
self.om_config_submat.grid(row=2, column=1)
# self.en_config_outpref=tk.Entry(fr_output, width=6, textvariable=self.st_outpref)
en_config_gapopen.grid(row=0, column=1)
en_config_gapextend.grid(row=1, column=1)
# en_config_submat.grid(row=2, column=1)
# self.en_config_outpref.grid(row=1, column=1)
# self.en_config_spliteach.grid(row=2,column=1)
self.en_config_fasta_header_delimiter.grid(row=0, column=1)
self.en_config_fasta_header_part.grid(row=1, column=1)
# nb.add(fr_mode, text=CF_MODE)
# nb.add(fr_paths, text=CF_PATHS)
nb.add(fr_penalties, text=CF_PENALTIES)
# nb.add(fr_output, text=CF_OUTPUT)
nb.add(fr_cleanup, text=CF_CLEANUP)
nb.add(fr_run, text=CF_RUN)
nb.add(fr_algorithm, text=CF_ALGORITHM)
# nb.add(fr_paralogs, text=CF_PARALOGS)
###################TODO#################
nb.add(fr_fastaheader, text=CF_FASTAHEADER)
nb.grid()
开发者ID:janinamass,项目名称:gardening,代码行数:67,代码来源:parseConfig.py
示例10: _entry
def _entry(self):
'''Method for creating widgets for collecting user input.'''
# N (no of turtles)
dim = 30*30
self.fill_label = Label(self._entryPane,
anchor='w',
justify='left',
text='Fill',
relief='raised',
width=12,
height=1,
font='italic 20')
self.fill_label.grid(row=0, column=1, ipady=14)
self.fill = Scale(self._entryPane,
from_=0,
to=1,
resolution=0.01,
bd=3,
relief='sunken',
orient='horizontal',
length=235,
tickinterval=20)
self.fill.grid(row=0, column=2)
self.fill.set(0.8)
self._N_label = Label(self._entryPane,
anchor='w',
justify='left',
text="N:",
relief='raised',
width=12,
height=1,
font="italic 20")
self._N_label.grid(row=1, column=1, ipady=14)
self._N = Scale(self._entryPane,
from_=0,
to=100,
resolution=1,
bd=3,
relief='sunken',
orient='horizontal',
length=235,
tickinterval=20)
self._N.set(30)
self._N.grid(row=1, column=2)
# Ticks (length of simulation)
self._Ticks_label = Label(self._entryPane,
anchor='w',
justify='left',
text="Time:",
relief='raised',
width=12,
height=1,
font="bold 20")
self._Ticks_label.grid(row=2, column=1, ipady=14)
self._Ticks = Scale(self._entryPane,
from_=10,
to=1000,
resolution=1,
bd=3,
relief='sunken',
orient='horizontal',
length=235,
tickinterval=990)
self._Ticks.set(500)
self._Ticks.grid(row=2, column=2)
# % similar wanted
self._Similar_label = Label(self._entryPane,
anchor='w',
justify='left',
text="Similar wanted:",
relief='raised',
width=12,
height=1,
font="bold 20")
self._Similar_label.grid(row=3, column=1, ipady=14)
self._Similar = Scale(self._entryPane,
from_=0.0,
to=1.0,
resolution=0.01,
bd=3,
relief='sunken',
orient='horizontal',
length=235,
tickinterval=0.5)
self._Similar.set(0.76)
self._Similar.grid(row=3, column=2)
# Delay between steps
self._delay_label = Label(self._entryPane,
#.........这里部分代码省略.........
开发者ID:cyneo,项目名称:feminism,代码行数:101,代码来源:schelling2.py
示例11: __init__
#.........这里部分代码省略.........
for opt in MAXCONFIG.options(section):
try:
self.txt_subsec[section].append(opt)
except KeyError as e:
self.txt_subsec[section]=[opt]
lab_sec=[]
lab_subsec={}
dd_subsec={}
self.var_subsec={}
for t in self.txt_sec:
lab_sec.append(tk.Label(fr_paths,text = t))
for t in self.txt_subsec:
#print(t,self.txt_subsec[t])
for u in self.txt_subsec[t]:
if t == CF_MODE:
fr = fr_mode
elif t == CF_PATHS:
fr = fr_paths
elif t == CF_CLEANUP:
fr = fr_cleanup
elif t == CF_RUN:
fr = fr_run
elif t == CF_PENALTIES:
fr = fr_penalties
elif t == CF_ALGORITHM:
fr = fr_algorithm
elif t == CF_FASTAHEADER:
fr = fr_fastaheader
#print("fastaheader_fr")
################################
else:
sys.stderr.write("No such section:",t)
try:
lab_subsec[t].append(tk.Label(fr,text = u))
self.var_subsec[t].append(tk.StringVar(fr))
if u in OPTIONS:
dd_subsec[t].append(OptionMenu(fr,self.var_subsec[t][-1],*OPTIONS[u]))
else:
dd_subsec[t].append("")
except KeyError as e:
try:
lab_subsec[t]=[tk.Label(fr,text = u)]
self.var_subsec[t]=[tk.StringVar(fr)]
if u in OPTIONS:
dd_subsec[t] = [OptionMenu(fr,self.var_subsec[t][-1],*OPTIONS[u])]
else:
dd_subsec[t] = [""]
except KeyError as e:
sys.stderr.write(str(e))
dd_subsec[t].append("")
for t in lab_subsec:
r=0
c=0
for i in lab_subsec[t]:
#print(i.cget("text"))
i.grid(row=r,column=c, sticky=tk.E)
r+=1
#print(r,i.cget("text"))
for t in dd_subsec:
c=1
r=0
for i in dd_subsec[t]:
#print(i)
if i is not "":
i.grid(row=r,column=c,sticky=tk.N)
r+=1
#print(r)
######################################
self.st_submat = tk.StringVar()
self.st_fasta_header_delimiter = tk.StringVar()
self.st_fasta_header_part = tk.StringVar()
#cpu_count starts at 0 for one cpu
self.sc_config_numthreads = Scale(fr_run, from_=1, to=multiprocessing.cpu_count(), orient=tk.HORIZONTAL)
self.sc_config_numthreads.grid(row=0, column=1, sticky=tk.E)
en_config_gapopen=tk.Entry(fr_penalties, textvariable=self.var_subsec[CF_PENALTIES][0])
en_config_gapextend=tk.Entry(fr_penalties,textvariable=self.var_subsec[CF_PENALTIES][1] )
self.en_config_fasta_header_delimiter= tk.Entry(fr_fastaheader,textvariable=self.st_fasta_header_delimiter,width=6 )
self.en_config_fasta_header_part= tk.Entry(fr_fastaheader,textvariable=self.st_fasta_header_part ,width=6 )
self.om_config_submat=tk.OptionMenu(fr_penalties, self.st_submat, *["EBLOSUM62","EDNAFULL"])
self.om_config_submat.grid(row=2,column=1 )
en_config_gapopen.grid(row=0, column=1)
en_config_gapextend.grid(row=1, column=1)
self.en_config_fasta_header_delimiter.grid(row=0, column=1)
self.en_config_fasta_header_part.grid(row=1,column=1)
nb.add(fr_penalties, text=CF_PENALTIES)
nb.add(fr_cleanup, text=CF_CLEANUP)
nb.add(fr_run, text=CF_RUN)
nb.add(fr_algorithm, text=CF_ALGORITHM)
nb.add(fr_fastaheader, text=CF_FASTAHEADER)
nb.grid()
b_config_cancel.grid(row=1, column=0, sticky=tk.E,padx=115)
b_config_apply.grid(row=1, column=0, sticky=tk.E,padx=50)
b_config_ok.grid(row=1, column=0, sticky=tk.E)
self.setFieldsFromConfig()
开发者ID:janinamass,项目名称:scythe,代码行数:101,代码来源:scythe-gui.py
示例12: create_voices
def create_voices(self):
voice_ids = ['1', '2', '3', '4']
SCALES = OrderedDict([
('pan_pos', {'min': -1, 'max': 1, 'start': 0.5, 'res': 0.001}),
('volume', {'min': 0, 'max': 1, 'start': 0.666, 'res': 0.001}),
('slide_duration_msecs', {'min': 0, 'max': 2000, 'start': 60, 'res': 1}),
('slide_duration_prop', {'min': 0, 'max': 2, 'start': 0.666, 'res': 0.001}),
('binaural_diff', {'min': 0, 'max': 66, 'start': 0.2, 'res': 0.01})
])
for vid in voice_ids:
counter = 0
for sca in SCALES:
name = 'voice_' + vid + '_' + sca
setattr(self, 'min_' + name, SCALES[sca]['min'])
setattr(self, 'max_' + name, SCALES[sca]['max'])
this_sca = Scale(self, label=sca, orient=HORIZONTAL,
from_=getattr(self, 'min_' + name),
to=getattr(self, 'max_' + name),
resolution=SCALES[sca]['res'])
this_sca.enable = ('enable' in list(SCALES[sca].keys()) and
SCALES[sca]['enable'] or None)
this_sca.disable = ('disable' in list(SCALES[sca].keys()) and
SCALES[sca]['disable'] or None)
this_sca.grid(column=int(2 + int(vid)), row=counter, sticky=E + W)
this_sca.bind("<ButtonRelease>", self.scale_handler)
this_sca.ref = name
counter += 1
CHECK_BUTTONS = OrderedDict(
[('mute', False),
('automate_binaural_diffs', True),
('automate_note_duration_prop', True),
('use_proportional_slide_duration', {'val': True, 'label': 'proportional slide'}),
('automate_pan', True),
('automate_wavetables', True)])
for vid in voice_ids:
counter = 0
cb_frame = LabelFrame(self, text="Voice {0} - Automation".format(vid))
setattr(self, 'voice_' + vid + '_cb_frame', cb_frame)
for cb in CHECK_BUTTONS:
options = CHECK_BUTTONS[cb]
name = 'voice_' + vid + '_' + cb
if isinstance(options, dict) and 'label' in list(options.keys()):
label = options['label']
else:
label = cb[9:] if cb[:9] == 'automate_' else cb
setattr(self, name, IntVar(
value=type(options) == dict and options['val'] or options))
self.this_cb = Checkbutton(cb_frame, text=label, variable=getattr(self, name))
self.this_cb.bind('<Button-1>', self.check_boxes_handler)
self.this_cb.disable = None
self.this_cb.grid(sticky=W, column=0, row=counter)
self.this_cb.ref = name
counter += 1
# add trigger wavetable-button
trigWavetableButton = Button(cb_frame, text='Next Wavetable')
trigWavetableButton.bind('<Button-1>', self.trigger_waveform_handler)
trigWavetableButton.ref = 'voice_' + vid + "_trigger_wavetable"
trigWavetableButton.grid(row=counter)
cb_frame.grid(column=int(vid) + 2, row=5, sticky=E + W + N, rowspan=8)
for vid in voice_ids:
generation_types = ["random", "random_harmonic", "harmonic"]
partial_pools = ["even", "odd", "all"]
prefix = 'voice_' + vid + '_'
types_name = prefix + 'wavetable_generation_type'
pools_name = prefix + 'partial_pool'
setattr(self, types_name, StringVar())
getattr(self, types_name).set("random")
setattr(self, pools_name, StringVar())
getattr(self, pools_name).set("all")
target_frame = getattr(self, 'voice_' + vid + '_cb_frame')
gen_typ_frame = LabelFrame(target_frame, text="type")
gen_typ_frame.grid(row=len(target_frame.winfo_children()), sticky=W)
for gen_t in generation_types:
gen_t_entry = Radiobutton(gen_typ_frame, value=gen_t, text=gen_t, anchor=W,
variable=getattr(self, types_name))
gen_t_entry.bind('<ButtonRelease-1>', self.wt_handler)
gen_t_entry.ref = types_name
gen_t_entry.grid(row=len(gen_typ_frame.winfo_children()), sticky=W)
pp_frame = LabelFrame(target_frame, text="harmonics")
for pp in partial_pools:
pp_entry = Radiobutton(pp_frame, value=pp, text=pp, anchor=W,
variable=getattr(self, pools_name))
pp_entry.bind('<ButtonRelease-1>', self.wt_handler)
pp_entry.ref = pools_name
pp_entry.grid(row=len(pp_frame.winfo_children()), sticky=E + W)
this_num_partials = Scale(pp_frame, label='number of harmonics', orient=HORIZONTAL,
from_=1, to=24, resolution=1)
this_num_partials.ref = prefix + 'num_partials'
this_num_partials.grid(column=0, row=len(pp_frame.winfo_children()), sticky=E + W)
this_num_partials.bind("<ButtonRelease>", self.scale_handler)
pp_frame.grid(row=len(target_frame.winfo_children()), sticky=E + W)
开发者ID:kr1,项目名称:roqba,代码行数:92,代码来源:main.py
示例13: CoCreateInstance
if __name__ == '__main__':
from tkinter import Tk, Scale
from comtypes import CoCreateInstance
from win32gui import GetParent
tbm = CoCreateInstance(GUID_CTaskbarList, interface=ITaskbarList3)
def onMove_gen(root):
def onMove(value):
tbm.SetProgressValue(GetParent(root.winfo_id()), int(value), 100)
return onMove
root = Tk()
tbar = Scale(root, from_=0, to=100, orient='horizontal', command=onMove_gen(root))
tbar.pack()
root.mainloop()
#class ITaskbarList(IUnknown):
# _iid_ = GUID('{56FDF342-FD6D-11D0-958A-006097C9A090}')
# _methods_ = [
# COMMETHOD([], HRESULT, 'HrInit'),
#
# COMMETHOD([], HRESULT, 'AddTab',
# (['in'], HWND, 'hwnd')
# ),
#
# COMMETHOD([], HRESULT, 'DeleteTab',
开发者ID:xialulee,项目名称:WaveSyn,代码行数:29,代码来源:definitions.py
示例14: Fenetre
class Fenetre(Tk):
def __init__(self):
Tk.__init__(self)
self.tilt_val_init = 110
self.pan_val_init = 75
self.pan_min = 0
self.pan_max = 105
self.tilt_min = 35
self.tilt_max = 135
self.pas = 5
# Full Screen
largeur, hauteur = self.winfo_screenwidth(), self.winfo_screenheight()
self.overrideredirect(0)
self.geometry("%dx%d" % (largeur, hauteur))
# TILT
self.tilt_bar = Scale(self, from_=self.tilt_min, to=self.tilt_max, length=250, label='Tilt', sliderlength=20,
orient=HORIZONTAL,
command=self.update_tilt)
self.tilt_bar.set((self.tilt_max + self.tilt_min) // 2)
self.tilt_bar.grid(row=1, column=2)
self.tilt_angle = StringVar()
self.tilt_val = self.tilt_bar.get()
# PAN
self.pan_bar = Scale(self, from_=self.pan_min, to=self.pan_max, length=250, label='Pan', sliderlength=20,
orient=HORIZONTAL,
command=self.update_pan)
self.pan_bar.set((self.pan_max + self.pan_min) // 2)
self.pan_bar.grid(row=2, column=2)
self.pan_angle = StringVar()
self.pan_val = self.pan_bar.get()
# PS3 Controller
self.bind("<a>", self.pan_plus)
self.bind("<d>", self.pan_moins)
self.bind("<s>", self.tilt_plus)
self.bind("<w>", self.tilt_moins)
self.bind("<p>", self.lean_left)
self.bind("<m>", self.lean_right)
self.bind("<q>", self.initialiser_positon)
self.bind("<j>", self.forward)
self.bind("<u>", self.reverse)
self.bind("<h>", self.left)
self.bind("<k>", self.right)
self.bind("<i>", self.break_motor)
self.bind("<Button-2>", self.alarm)
self.bind("<Button-3>", self.beep)
# Motor
self.gear = 0
self.speed_init = 5
self.speed = self.speed_init
self.leds = [led_1, led_2, led_3]
self.bind("<e>", self.shift_down)
self.bind("<r>", self.shift_up)
self.pwm = gpio.PWM(enable_pin, 50) # 50 is the frequency
# Infos
self.pas_label = Label(self, text=str(self.pas))
self.pas_label.grid(row=3)
self.buzzer_state = 0
#--------Buzzer--------
def beep(self, event, time=100):
self.buzzer_on()
self.after(time, self.buzzer_off)
def buzzer_on(self):
gpio.output(buzzer, gpio.HIGH)
self.buzzer_state = 1
def buzzer_off(self):
gpio.output(buzzer, gpio.LOW)
self.buzzer_state = 0
def alarm(self, event):
if self.buzzer_state == 0:
gpio.output(buzzer, gpio.HIGH)
self.buzzer_state = 1
else:
gpio.output(buzzer, gpio.LOW)
self.buzzer_state = 0
#-------Camera-------
#-------Motor-------
def shift_up(self, event):
if self.gear != 3:
self.gear += 1
gpio.output(self.leds[self.gear - 1], gpio.HIGH)
else:
self.beep(event, time=70)
if self.gear == 0:
self.speed = self.speed_init
#.........这里部分代码省略.........
开发者ID:Yass1408,项目名称:ChapPi,代码行数:101,代码来源:finale.py
示例15: __init__
def __init__(self):
Tk.__init__(self)
self.tilt_val_init = 110
self.pan_val_init = 75
self.pan_min = 0
self.pan_max = 105
self.tilt_min = 35
self.tilt_max = 135
self.pas = 5
# Full Screen
largeur, hauteur = self.winfo_screenwidth(), self.winfo_screenheight()
self.overrideredirect(0)
self.geometry("%dx%d" % (largeur, hauteur))
# TILT
self.tilt_bar = Scale(self, from_=self.tilt_min, to=self.tilt_max, length=250, label='Tilt', sliderlength=20,
orient=HORIZONTAL,
command=self.update_tilt)
self.tilt_bar.set((self.tilt_max + self.tilt_min) // 2)
self.tilt_bar.grid(row=1, column=2)
self.tilt_angle = StringVar()
self.tilt_val = self.tilt_bar.get()
# PAN
self.pan_bar = Scale(self, from_=self.pan_min, to=self.pan_max, length=250, label='Pan', sliderlength=20,
orient=HORIZONTAL,
command=self.update_pan)
self.pan_bar.set((self.pan_max + self.pan_min) // 2)
self.pan_bar.grid(row=2, column=2)
self.pan_angle = StringVar()
self.pan_val = self.pan_bar.get()
# PS3 Controller
self.bind("<a>", self.pan_plus)
self.bind("<d>", self.pan_moins)
self.bind("<s>", self.tilt_plus)
self.bind("<w>", self.tilt_moins)
self.bind("<p>", self.lean_left)
self.bind("<m>", self.lean_right)
self.bind("<q>", self.initialiser_positon)
self.bind("<j>", self.forward)
self.bind("<u>", self.reverse)
self.bind("<h>", self.left)
self.bind("<k>", self.right)
self.bind("<i>", self.break_motor)
self.bind("<Button-2>", self.alarm)
self.bind("<Button-3>", self.beep)
# Motor
self.gear = 0
self.speed_init = 5
self.speed = self.speed_init
self.leds = [led_1, led_2, led_3]
self.bind("<e>", self.shift_down)
self.bind("<r>", self.shift_up)
self.pwm = gpio.PWM(enable_pin, 50) # 50 is the frequency
# Infos
self.pas_label = Label(self, text=str(self.pas))
self.pas_label.grid(row=3)
self.buzzer_state = 0
开发者ID:Yass1408,项目名称:ChapPi,代码行数:66,代码来源:finale.py
示例16: Application
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind((host, port))
self.grid()
self.columnconfigure(0, minsize=100)
self.columnconfigure(1, minsize=200)
self.columnconfigure(2, minsize=200)
self.columnconfigure(3, minsize=150)
self.columnconfigure(4, minsize=150)
self.columnconfigure(5, minsize=150)
self.columnconfigure(6, minsize=150)
self.create_widgets()
self.settables = self.assemble_settables()
self.gui_logger = logging.getLogger('gui')
self.request_update()
def create_widgets(self):
self.create_monitor()
self.create_check_buttons()
self.create_ranges()
self.create_scales()
self.create_radio_buttons()
self.create_voices()
self.quitButton = Button(self, text='Quit', command=self.quit)
self.quitButton.grid(columnspan=7, sticky=E + W)
def assemble_settables(self):
settables = self.winfo_children()
for w in settables:
settables += w.winfo_children()
return [w for w in settables if w.__class__.__name__ in ['Scale', 'Checkbutton']]
def create_radio_buttons(self):
# Scale related
entries = ['DIATONIC', 'HARMONIC', 'MELODIC', 'PENTATONIC', 'PENTA_MINOR',
'GREEK_CHROMATIC', 'GREEK_ENHARMONIC']
self.scale = StringVar()
self.scale.set('DIATONIC')
self.rb_frame = Frame(self)
for e in entries:
rb = Radiobutton(self.rb_frame, value=e, text=e, anchor=W,
command=self.send_scale, variable=self.scale)
rb.grid(row=len(self.rb_frame.winfo_children()), sticky=W)
self.rb_frame.grid(column=1, row=len(self.grid_slaves(column=1)), rowspan=3)
def create_monitor(self):
self.monitor_frame = LabelFrame(self, text="Monitor and Transport")
this_cycle = Scale(self.monitor_frame, label='cycle_pos', orient=HORIZONTAL,
from_=1, to=16, resolution=1)
this_cycle.disable, this_cycle.enable = (None, None)
this_cycle.ref = 'cycle_pos'
this_cycle.grid(column=0, row=0, sticky=E + W)
self.updateButton = Button(self.monitor_frame,
text='Reload all Settings',
command=self.request_update)
self.updateButton.grid(row=1, sticky=E + W)
self.ForceCaesuraButton = Button(self.monitor_frame,
text='Force Caesura',
command=self.force_caesura)
self.ForceCaesuraButton.grid(row=2, sticky=E + W)
self.saveBehaviourButton = Button(self.monitor_frame,
text='Save current behaviour',
command=self.request_saving_behaviour)
self.saveBehaviourButton.grid(row=3, sticky=E + W)
self.saveBehaviourNameEntry = Entry(self.monitor_frame)
self.saveBehaviourNameEntry.grid(row=4, sticky=E + W)
self.saveBehaviourNameEntry.bind('<KeyRelease>', self.request_saving_behaviour)
self.selected_behaviour = StringVar()
self.selected_behaviour.trace('w', self.new_behaviour_chosen)
self.savedBehavioursMenu = OptionMenu(self.monitor_frame,
self.selected_behaviour, None,)
self.savedBehavioursMenu.grid(row=5, sticky=E + W)
self.monitor_frame.grid(column=0, row=10, sticky=E + W)
def request_update(self):
self.send({'sys': 'update'})
def request_saving_behaviour(self, event=None):
"""callback for save behaviour button and textentry"""
if event and event.widget == self.saveBehaviourNameEntry:
if event.keysym == 'Return':
name = self.saveBehaviourNameEntry.get()
self.saveBehaviourNameEntry.delete(0, len(name))
else:
return
else: # button was pressed
name = self.saveBehaviourNameEntry.get()
if name:
self.send({'sys': ['save_behaviour', name]})
def force_caesura(self):
self.send({'force_caesura': True})
def create_voices(self):
voice_ids = ['1', '2', '3', '4']
SCALES = OrderedDict([
('pan_pos', {'min': -1, 'max': 1, 'start': 0.5, 'res': 0.001}),
#.........这里部分代码省略.........
开发者ID:kr1,项目名称:roqba,代码行数:101,代码来源:main.py
示例17: Visual
#.........这里部分代码省略.........
x, y = self.trans.screen((-5 * (time / 100)), -0.05)
x1, y = self.trans.screen(time, -0.05)
self._graph.create_line(x, y, x1, y, fill="white", width=1.5)
# Text x-axis
x_text, y_text = self.trans.screen(time / 2, -0.15)
self._graph.create_text(x_text, y_text,
text="
|
请发表评论