Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5947825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:01:11+00:00 2026-05-22T17:01:11+00:00

I have three PyGTK SpinButtons that are mutually dependent on each other: call them

  • 0

I have three PyGTK SpinButtons that are mutually dependent on each other: call them A, B, and C. There is another button D that toggles between two reciprocal definitions of C, such that the value of C is defined as A/B unless D has been pressed an odd number of times.

I want to be able, for example, to change A and have B or C update immediately according to this relationship. I also want to be able to change B and have A or C update immediately. Same goes for C. I’ve decided that when one is changed, the SpinButton that was least recently changed should be updated, and that if no SpinButtons have been changed since the program began, it should be assumed that C was changed most recently.

Everything above has been implemented. My application listens for the value-changed signals for each of the SpinButtons, performs the calculations above, and then updates the value of the other two as described. However, the application picks up its own changes and responds to them. When I change A, my program changes B, which is handled by changing C, and so on. I have tried the change-value signal too but it does not respond to changes to the SpinButton.

How do I listen for a change in value of a SpinButton in a way that will not be triggered by the program itself?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:01:12+00:00Added an answer on May 22, 2026 at 5:01 pm

    You can disable the signal handler for a given spinner before calling set_value on it. This ensures that the signal is only fired in reaction to mouse and keyboard events, not programmatic changes. Here is a quick example:

    import pygtk, gtk
    win = gtk.Window(gtk.WINDOW_TOPLEVEL)
    win.connect('destroy', lambda w: gtk.main_quit())
    
    def _add_spinner():
        adj = gtk.Adjustment(0.0, -100.0, 100.0, 1.0, 2.0, 0.0)
        spin = gtk.SpinButton(adj, 0, 1)
        spin.set_wrap(True)
        hbox.pack_start(spin, True, True, 10)
        return spin
    
    vbox = gtk.VBox(True, 10)
    hbox = gtk.HBox(True, 10)
    vbox.pack_start(hbox, True, True, 10)
    spin1 = _add_spinner()
    spin2 = _add_spinner()
    win.add(vbox)
    
    def set_spin(src, dst):
        # ensure that calling `set_value` does not fire events
        hid = handlers.get(dst)
        dst.handler_block(hid)
        dst.set_value(src.get_value() + 1.5)
        dst.handler_unblock(hid)
    
    # when 'spinN' is changed, call 'set_spin'
    hid1 = spin1.connect('value-changed', set_spin, spin2)
    hid2 = spin2.connect('value-changed', set_spin, spin1)
    handlers = {spin1: hid1, spin2: hid2}
    win.show_all()
    gtk.main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pygtk Table with 16 squares, each of them containing a label.
I have a PyGTK GUI that has a gtk.Table. Pressing one button will generate
I have three yellow bars and each of them needs to come from left
I have three dropdown list each dependent on previous one. How it is possible
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have three domains (domain1.es, domain2.com, domain3.com). I need that: domain1.es OR www.domain1.es, show
I have a python program that implements pygtk for GUI. I have it running
I have three JSF apps working on glassfish 3.1 opensource edition. One of them
I have three models : class LevelTwoArea < ActiveRecord::Base has_many :places, dependent: :restrict end
I have an application which depends on PyGTK, PyGobject, and PyCairo that I built

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.