#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0

    Major gui confusion!


    I'm trying to do what I thought to be trivial, but can't seem to catch on. I want to create a mid-sized GUI to both receive data from my python 2.7 program, and get input from the user. I don't beleive I need a huge framework like Django. I have looked at wxWidgets, PySide, PyQt etc., but I encounter the same confusion (& frustration) with all of them, so I guess I'm missing something very basic. I want to get the data from the gui (clicked signals from pushbuttons, radio buttons, etc) back into my python script or a function so that I can handle the input data from my script. Everything I see is a framework of signals & slots and I don't see an easy way to pass data/variables back to my script directly. If I can just get user input back to my script, and output data to a listbox or frame, I think that would do the trick. What am I missing?
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,673
    Rep Power
    1958
    Originally Posted by lgabrielson
    What am I missing?
    It will be easier to help if you can post the code and what you have tried with it.

    What kind of confusion/frustration do you have with the modules you have looked at?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0
    Originally Posted by MrFujin
    It will be easier to help if you can post the code and what you have tried with it.

    What kind of confusion/frustration do you have with the modules you have looked at?
    I've looked at PyQt and PySide and like the easy way you can lay out a nice looking GUI. I'm a very old fashioned programmer, and frankly, I just don't see the program flow. A signal from a button gets (miracluliously) passed to a slot that also resides within the package, (whether it's Qt or PySide). How do I capture that event/action and use it in my script?

    For example:
    Here is an example of what I'm finding vs. what I want to do:

    Here's a slider and an LCD window.
    http://zetcode.com/tutorials/pyqt4/eventsandsignals/

    It works great, but I want to capture the value of the slider back to a function in my program, not the LCD. Possibly Qt is not the right package for me??! Guess visual basic wasn't so bad after all. LOL.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0

    well... maybe I have to start over


    I found a comment that probably sums up my problem.

    http://www.commandprompt.com/community/pyqt/c1036#AEN1040

    "Unlike a tool like Visual Basic, which consists of a GUI engine with a scripting language built-in, Python does not have a native GUI interface. But there are many GUI libraries available for Python examples are wxPython, Tkinter, PyGTK, PyFLTK, FoxPy, and PyQt. PyQt is based on Qt, an advanced GUI library for Windows and Unix written in C++ by Eirik Eng and Arnt Gulbrantsen of Trolltech in Norway. It's quite easy to wrap C++ or C libraries so they can be used from Python and when Phil Thompson was looking around for a good GUI library for Python he decided to wrap Qt, producing PyQt. PyQt forms the basis for the BlackAdder rapid development environment."

    I will probably have to seriously study PyQt4 and rewrite my script, embedding it into Qt. At least that seems to be the case. Live and learn.
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    611
    Rep Power
    65
    You could use threading to run your GUI out of the same script.
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0
    I thought of that, but read something that made me think it wouldn't work so didn't follow up. It's definitely worth taking another look at!

    I've been looking at PyQt4 and PySide also but can't find a simple example of accessing a sqlite(3) database with it.... if anybody knows of a noobs guide to PySide & sqlite, please point me in that direction.

    Meanwhile, I'll dig deeper into threading & my original script.

    Thanks
  12. #7
  13. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    611
    Rep Power
    65
    You might want to look at:
    http://joplaete.wordpress.com/2010/07/21/threading-with-pyqt4/
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0
    Thanks. That's a great help. It would be so much easier (at least for now) to run things separately if possible. I'm going to have to take PyQt4 a little slow... it's very new to me.

IMN logo majestic logo threadwatch logo seochat tools logo