SHOW:
|
|
- or go back to the newest paste.
1 | - | #pylint:disable=E0001 |
1 | + | #pylint:disable=E0001 |
2 | - | #pylint:disable=E0001 |
2 | + | #pylint:disable=E0001 |
3 | - | #pylint:disable=E0602 |
3 | + | #pylint:disable=E0602 |
4 | - | from tkinter import * |
4 | + | from tkinter import * |
5 | - | class Block: |
5 | + | class Block: |
6 | - | def __init__(self, master,name_fr): |
6 | + | def __init__(self, master,name_fr): |
7 | - | self.block_frame=LabelFrame(master,text=name_fr) |
7 | + | self.block_frame=LabelFrame(master,text=name_fr) |
8 | - | var1=BooleanVar() |
8 | + | var1=BooleanVar() |
9 | - | var1.set(0) |
9 | + | var1.set(0) |
10 | - | self.check=Checkbutton(self.block_frame) |
10 | + | self.check=Checkbutton(self.block_frame) |
11 | - | self.ent=Entry(self.block_frame, width=10) |
11 | + | self.ent=Entry(self.block_frame, width=10) |
12 | - | self.block_frame.pack() |
12 | + | self.block_frame.pack() |
13 | - | self.check.pack(side=LEFT) |
13 | + | self.check.pack(side=LEFT) |
14 | - | self.ent.pack(side=LEFT) |
14 | + | self.ent.pack(side=LEFT) |
15 | - | root = Tk() |
15 | + | root = Tk() |
16 | - | |
16 | + | |
17 | - | ent_in=Entry(root, width=20) |
17 | + | ent_in=Entry(root, width=20) |
18 | - | but=Button(width=20,text='enter neurons') |
18 | + | but=Button(width=20,text='enter neurons') |
19 | - | ent_in.pack() |
19 | + | ent_in.pack() |
20 | - | but.pack() |
20 | + | but.pack() |
21 | - | |
21 | + | |
22 | - | def neuronCreate(event): |
22 | + | def neuronCreate(event): |
23 | - | neuronQ=int(ent_in.get()) |
23 | + | neuronQ=int(ent_in.get()) |
24 | - | for i in range(1,neuronQ): |
24 | + | for i in range(1,neuronQ): |
25 | - | globals()[f'nrBlock_{i}']=Block(root,'neuron '+str(i)) |
25 | + | globals()[f'nrBlock_{i}']=Block(root,'neuron '+str(i)) |
26 | - | testLab=Label(text=globals()['nrBlock_3'], wraplength=800) |
26 | + | testLab=Label(text=globals()['nrBlock_3'], wraplength=800) |
27 | - | testLab.pack() |
27 | + | testLab.pack() |
28 | - | but.bind('<Button-1>',neuronCreate) |
28 | + | but.bind('<Button-1>',neuronCreate) |
29 | - | root.mainloop() |
29 | + | root.mainloop() |
30 | - | |
30 | + | |
31 | ||
32 |