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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:13:54+00:00 2026-05-19T22:13:54+00:00

I am writing a gui program that allows a user to repeatedly send a

  • 0

I am writing a gui program that allows a user to repeatedly send a message to a phone number with a configurable delay and number of repetitions.

I used QT Designer to create a gui, and now I am trying to create the code behind it. I am trying to make the program start sending messages when the start button is pressed, but not freeze the gui.

I am trying to use gobject.timeout_add_seconds to check if new messages need to be send every 1s, but when it is causing a Segmentation Fault.

queueMessages is called whenever the button is pressed to start sending messages, and sendMessages should be run every 1s to send any needed messages.

Let me know if there is an easier way to do this (such as threading). I am open to any other ideas.

Here’s the applicable code. I can include the gui code too if that would be helpful:

#!/usr/bin/python2.5
import sys, os
import time
import gobject
from PyQt4 import QtGui,QtCore
from smsBomb import *

class MyForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        #build parent user interface
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        # Create button actions
        QtCore.QObject.connect(self.ui.btnSendMessages, QtCore.SIGNAL('clicked()'), self.queueMessages)
        # Check if we need to send any messages every 1s.
        self.maintimer = gobject.timeout_add_seconds(1, self.sendMessages)

    def queueMessages(self):
        # Queue messages!
        number = str(self.ui.txtNumber.text())
        message = str(self.ui.txtMessage.text())
        delay = int(self.ui.txtDelay.text())
        repetitions = int(self.ui.txtRepetitions.text())
        for i in range(repetitions):
            os.system('dbus-send --dest=org.QGVDial.TextServer --session --print-reply /org/QGVDial/TextServer org.QGVDial.TextServer.Text array:string:"+1' + number + '" string:"' + message + '"')
            #time.sleep(delay)

    def sendMessages(self):
        # Send Queued Messages as needed
        print "Sending queued messages..."
        return True

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MyForm()
    myapp.show()
    sys.exit(app.exec_())
  • 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-19T22:13:54+00:00Added an answer on May 19, 2026 at 10:13 pm

    You appear to be using a (Py)GTK timer object within a (Py)Qt application. Try replacing

        self.maintimer = gobject.timeout_add_seconds(1, self.sendMessages)
    

    with the equivalent PyQt code

        self.maintimer = QtCore.QTimer(self);
        self.connect(self.maintimer, QtCore.SIGNAL('timeout()'), self.sendMessages)
        self.maintimer.start(1000)
    

    I was able to reproduce the segfault using gobject.timeout_add_seconds, and it went away once I replaced the PyGTK timer with a PyQt one. I can’t be sure why this happens, but this article gives a possible reason:

    One caveat I found, gobject.timeout_add_seconds() seems to depend on the GTK main loop, so you cannot use it from a regular non-GTK python application.

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

Sidebar

Related Questions

I've got a GUI C++ program that takes a shell command from the user,
I'm writing a Java program that's supposed to be the GUI frontend that utilizes
I'm currently writing a little GUI program that does some work and exits afterwards.
I'm writing a small GUI app that contains some editor functionality, and something that
I'm writing some data acquisition software and need a gui plotting library that is
How play standard system sounds from a Python script? I'm writing a GUI program
I am writing a GUI program using PyQt4. There is a button in my
I'm writing a Python program with a GUI built with the Tkinter module. I'm
For a script that will check/set a Windows registry value. No GUI. Am writing
I'm writing a little program that basically has a bunch of buttons that when

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.