Modérateur : darcmorcel
Oui, il y a trois démo vidéos. J'ai ce module à la maison et, oui, elle sonne plutôt bien !
Code : Tout sélectionner
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import tkinter as tk
import tkinter.messagebox
SEP = ";"
SEP2 = ","
def search(ref, components, clines):
key = ref.get()
if not key in components.keys():
tk.messagebox.showerror("Searching component %s"%key, "Unknown component \"%s\"!"%key)
else:
tk.messagebox.showinfo("Searching component %s"%key, "Value of %s is %s on line #%u"%(key, components[key], clines[key]))
print(key, components[key])
with open("./Modular-Mini-Drums-b-nomenclature.csv", "r") as fp:
lines = fp.readlines()
cells = []
for line in lines:
cells.append(line.strip().split(SEP))
components = {}
clines = {}
for line_num, cell in enumerate(cells):
if len(cell) >= 3 and cell[0] != "Reference":
keys = [word.strip() for word in cell[0].split(SEP2)]
if len(cell[0]):
value = cell[2]
for key in keys:
if key != "":
if key in components.keys():
print("componenent %s (%s) already declared as %s (%s)!"%(key, value, key, components[key]))
components[key] = value
clines[key] = line_num + 1
win = tk.Tk()
ref = tk.StringVar()
tk.Entry(win, textvariable=ref).grid(row=0, column = 0)
tk.Button(win, text=" Search ", command=lambda ref=ref, components=components, clines=clines:search(ref, components, clines)).grid(row=0, column = 1)
win.mainloop()
Oups, tu as raisonMolzy a écrit :...sauf pour la R425 qui est notée 100K sur le schéma...