connect to scale

More
10 years 11 months ago #65271 by markder13
Replied by markder13 on topic connect to scale
It Works.

the correct code for pyton is:
Code:
def on_HighHb_value_changed(self, widget, data = None): value = widget.get_value()

Note that the _adj is not there.

My lesson learned: (and hopefully also for other newbies') the text in glade under Signals -> GtkRange -> value change in Handler box is: on_<name of widget>_value_changed is to be repeated in the python file.
See screen shoot.

Mark

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago - 10 years 11 months ago #65276 by newbynobi
Replied by newbynobi on topic connect to scale
Hallo Mark,

glad you got it working, but your comment, the adjust is not there is not correct.
A Scale is not able to work without an adjustment!
In your ui file, you have the scale HighH_b controlling the adjustment3.

My recommendation is to rename that one to adj_HighH_b and connect your handler to the signal of the adjustment!
You may ask why, as the connection you made does work. This is only my personal experience from the work with gmoccapy. I had some strange behaviors connecting to the scale instead to the adjustments. After changing the signals handler connection from the scale to the adjustment, everythink worked as expected.

Another recommendation is to rename all widgets to "speeking" names, as in your code adjustment1, adjustment2, etc. will result in difficulties in reading and understanding it. But remember window1 must remain window1!

I attached a simple example to show what I mean.
Check the code and you will see, that all widgets and functions do have clear names, to be recognized better in code.

Norbert
Last edit: 10 years 11 months ago by newbynobi.
The following user(s) said Thank You: markder13

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #65313 by markder13
Replied by markder13 on topic connect to scale
Norbert,

thx. It worksfine.

Now all makes prefect sense.

Mark

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.312 seconds
Powered by Kunena Forum