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 6665467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:43:35+00:00 2026-05-26T02:43:35+00:00

try to send signal from one gtk.EventBox child to another. on init HeadMode (line

  • 0

try to send signal from one gtk.EventBox child to another.

on init HeadMode (line 75) got error:

TypeError : unknown signal name: message-send

why?

#!/usr/bin/env python
# -*- coding: utf8 -*-

import pygtk
pygtk.require('2.0')
import gtk
import gobject


def Destroy(widget):
    gtk.main_quit()


class CustomEventBox(gtk.EventBox):
    def __init__(self):
        super(CustomEventBox, self).__init__()
        self.press_hid = self.connect("button_press_event", self.on_press)
        self.release_hid = self.connect("button_release_event", self.on_release)
        self.set_custom_color()
        self.show()

    def on_press(self, widget, event):
        print "v: " + widget.label.get_text()
        widget.pressed()

    def on_release(self, widget, event):
        print "^: " + widget.label.get_text()
        widget.released()

    def pressed(self):
        pass

    def released(self):
        pass

    def set_custom_color(self):
        pass


class OrderBox(CustomEventBox):
    def __init__(self, label_text):
        super(OrderBox, self).__init__()
        self.label = gtk.Label(label_text)
        self.add(self.label)
        self.label.show()

    def set_custom_color(self):
        bg = self.get_colormap().alloc_color('white')
        self.modify_bg(gtk.STATE_NORMAL, bg)
        self.emit('message-send', 'normal')

    released = set_custom_color

    def pressed(self):
        bg = self.get_colormap().alloc_color('green')
        self.modify_bg(gtk.STATE_NORMAL, bg)
        self.emit('message-send', 'pressed')

gobject.type_register(OrderBox)
gobject.signal_new('message-send', OrderBox, gobject.SIGNAL_RUN_FIRST | gobject.SIGNAL_ACTION,
                   gobject.TYPE_NONE, (gobject.TYPE_STRING, ))


class HeadMode(CustomEventBox):
    def __init__(self, mode):
        super(HeadMode, self).__init__()
        self.mode = mode
        self.label = gtk.Label('')
        align = gtk.Alignment(0.1, 0.5, 0, 0) 
        align.add(self.label)
        align.show()
        self.add(align)
        self.set_custom_mode(self.mode)
        print gobject.signal_list_names(OrderBox)
        self.connect('message-send', self.on_message)

    def on_message(self, widget):
        print widget

    def set_custom_mode(self, mode, data=None):
        self.label.set_label(mode)

# gobject.type_register(HeadMode)


class MainWindow(object):
    def __init__(self):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title("Signal Demo")
        window.connect("destroy", Destroy)
        window.set_border_width(8)
        vbox = gtk.VBox()
        window.add(vbox)
        head = gtk.HBox()
        head.pack_start(HeadMode('start'), False, True, 4)
        head.show()
        vbox.pack_start(head, False, True, 4) 
        table = gtk.Table(3, 3, False)
        vbox.pack_start(table)
        vbox.show()

        for cx in range(3):
            for cy in range(3):
                if cy < 3 or (cy == 3 and cx <=5):
                    label_text = "11300%i0%i" % (cx+1, cy+1)
                else:
                    label_text = ""

                event_box = OrderBox(label_text)
                table.attach(event_box, cx, cx+1, cy, cy+1,
                          xpadding=4, ypadding=4)
                # More things you need an X window for ...
                event_box.realize()
        table.show()
#        window.fullscreen()
        window.show()


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    MainWindow()
    main()
  • 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-26T02:43:36+00:00Added an answer on May 26, 2026 at 2:43 am

    You have to define message-send signal for the object you are emiting or connecting obj.emit('message-send', ...) or obj.connect('message-send', ...) no matter where are you doing these things.

    You have not defined signal message-send for HeadMode class. So, this line is wrong:

            self.connect('message-send', self.on_message)
    

    Maybe you want do something like this:

            self.order_box.connect('message-send', self.on_message)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i try to send some data to my php file from ajax , but
I try to send json array to ajax (from PHP to jQuery) in my
I try to send a message from to global page to my injected.js on
i try to send private message to followers of a user who is already
I try to send an email, but I have a problem, however, I found
I try to send gps longitude and latitude to the android emulator with eclipse,
I try to send a request to my server via GET, but qooxdoo sends
i try to send data to my php scripts but i think i miss
i try to send my datas to php with ajax but there's strange mistake.
I try to send a sms using next code, but recipient gets my message

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.