- Posts: 1
- Thank you received: 0
How to add new checkButton
- connor70909
- Topic Author
- Offline
- New Member
-
Less
More
10 years 7 months ago #71548
by connor70909
How to add new checkButton was created by connor70909
Hello,
I have a question about how to get the value of checkButton,
Down is my code,
In axis.tcl , I add a new menu learn . In menu_learn , I add a checkButton
.menu.learn add checkbutton \
-command edit_learn \
-variable ilc_check
In axis.py, I have to get the value from checkButton which is True or False
def edit_learn(*event):
if event == 1:
f = open('/home/A.txt', 'w')
f.write('hello1\n')
f.close()
Thanks!
I have a question about how to get the value of checkButton,
Down is my code,
In axis.tcl , I add a new menu learn . In menu_learn , I add a checkButton
.menu.learn add checkbutton \
-command edit_learn \
-variable ilc_check
In axis.py, I have to get the value from checkButton which is True or False
def edit_learn(*event):
if event == 1:
f = open('/home/A.txt', 'w')
f.write('hello1\n')
f.close()
Thanks!
Please Log in to join the conversation.
10 years 6 months ago #72487
by BigJohnT
Replied by BigJohnT on topic How to add new checkButton
You might try posting this on the mailing list. The TCL guru hangs out there.
JT
JT
Please Log in to join the conversation.
10 years 6 months ago #72489
by BigJohnT
Replied by BigJohnT on topic How to add new checkButton
You might try posting this on the mailing list. The TCL guru hangs out there.
JT
JT
Please Log in to join the conversation.
10 years 6 months ago #72568
by ArcEye
You already have the examples you need in the 2 files you have altered
Search for the menu entry show_program, which is a toggle button value from a checkbutton, in axis.tcl
Then search for def show_program event handler in axis.py
You will see how to check the value of the variable.
Your code currently sets a variable ilc_check and then does not use it, instead trying to test whether the pointer *event == 1,
which it never will be.
An event pointer is a pointer to a struct giving info about the window event that initiated the call to the handler, it is nothing to do with the variable you set and you cannot get that info from it.
It contains things like
type
window
time
x
y
state
regards
Replied by ArcEye on topic How to add new checkButton
In axis.tcl , I add a new menu learn . In menu_learn , I add a checkButton
.menu.learn add checkbutton \
-command edit_learn \
-variable ilc_check
In axis.py, I have to get the value from checkButton which is True or False
def edit_learn(*event):
if event == 1:
f = open('/home/A.txt', 'w')
f.write('hello1\n')
f.close()
You already have the examples you need in the 2 files you have altered
Search for the menu entry show_program, which is a toggle button value from a checkbutton, in axis.tcl
Then search for def show_program event handler in axis.py
You will see how to check the value of the variable.
Your code currently sets a variable ilc_check and then does not use it, instead trying to test whether the pointer *event == 1,
which it never will be.
An event pointer is a pointer to a struct giving info about the window event that initiated the call to the handler, it is nothing to do with the variable you set and you cannot get that info from it.
It contains things like
type
window
time
x
y
state
regards
Please Log in to join the conversation.
Time to create page: 0.094 seconds
