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

  • Home
  • SEARCH
  • 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 944031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:31:37+00:00 2026-05-15T22:31:37+00:00

I have an application where my DataFetch() class Wraps around my HBHTray() class for

  • 0

I have an application where my DataFetch() class “Wraps” around my HBHTray() class for the purpose of interacting with the functions/variables of that class. Unfortunately, I can’t seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start() method of HBHTray it hangs.

This is the relevant code:


class DataFetch(): # I need the DataFetch class to be wrapping around HBHTray so I can call/edit certain variables from within functions in DataFetch
    def init(self):
        self.Interval, self.Username, self.Password, self.CheckShoutBox = GetOptions('.tray')
        self.Gui = HBHTray()
        print '1'
        self.Gui.Start()
        print '2'
    def Login(self):
        pass # Do stuff (Eg: Edit self.Gui.StatusIcon state or call self.Gui.Notify()
    def Start(self):
        print 'hi!'
        sleep(self.Interval)
        print 'Hi!'
class HBHTray():
    def init(self):
        self.StatusIcon = gtk.StatusIcon()
        self.StatusIcon.set_from_file('img')
        self.StatusIcon.set_tooltip('No new messages')
        self.Menu = gtk.Menu()
            self.CheckBox = gtk.CheckMenuItem('Notify')
            self.CheckBox.connect('activate', self.ChangeCheckBox)
            self.CheckBox.set_active(True)
            self.Menu.append(self.CheckBox)
        self.MenuItem = gtk.ImageMenuItem('Options')
        self.MenuItem.connect('activate', self.Options, self.StatusIcon)
        self.Menu.append(self.MenuItem)
        self.MenuItem = gtk.ImageMenuItem('About')
        self.MenuItem.connect('activate', self.About, self.StatusIcon)
        self.Menu.append(self.MenuItem)
        self.MenuItem = gtk.ImageMenuItem('Quit')
        self.MenuItem.connect('activate', self.Quit, self.StatusIcon)
        self.Menu.append(self.MenuItem)
        self.StatusIcon.connect('popup-menu', self.PopMenu, self.Menu)
        self.StatusIcon.set_visible(1)
    def PopMenu(self, widget, button, time, data = None):
        if data:
            data.show_all()
            data.popup(None, None, gtk.status_icon_position_menu, 3, time, self.StatusIcon)
    def Notify(self, message):
        pynotify.init('null')
        notification = pynotify.Notification('Something', message, 'dialogue')
        notification.attach_to_status_icon(self.StatusIcon)
        notification.show()
    def Start(self):
        gtk.main()
    def About(self, a, b):
        self.Notify('test')
    def Options(self, a, b):
        print a, b
    def ChangeCheckBox(self, null):
        pass
    def Quit(self, a, b):
        raise SystemExit
if name == 'main':
    try:
        gobject.threads_init() # Doesn't work?
        Monitor = DataFetch()
        Monitor.Start()

Sorry for the terrible formatting, Stack Overflow doesn't seem to like blank lines....
Anyways, though, "1" is printed, but "2" is not. So, gtk.main() is obviously where it's hanging. Is there any way to allow me to continue execution and have gtk go do it's own thing?

  • 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-15T22:31:38+00:00Added an answer on May 15, 2026 at 10:31 pm

    Turns out the problem was that I couldn’t find a working solution because I was utilizing the Thread module the wrong way and calling run() directly when I should have been calling start(). Because of that, I was thinking that nothing I did worked (especially with no error or complaint from anything) and figured it was a problem relating to how I was wrapping gtk.main()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.