Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Running into problems using a simple gui multithreaded application. FRUSTRATED AND NEED HELP !
Forum Updated to NodeBB v4.3 + New Features

Running into problems using a simple gui multithreaded application. FRUSTRATED AND NEED HELP !

Scheduled Pinned Locked Moved General and Desktop
22 Posts 4 Posters 7.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alonhalawi
    wrote on 27 Jul 2014, 09:30 last edited by
    #21

    Will upload it very soon. Just got back from Prague :)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alonhalawi
      wrote on 11 Aug 2014, 16:07 last edited by
      #22

      Sorry for the delay, as I promised I am uploading the code.

      Gui.py
      @
      import Tkinter as Tk
      from PIL import Image, ImageTk
      import tkMessageBox as tkMsgBox

      def version_click(shr_objs):
      print "version_click is called"
      print 'this is my global segment:', shr_objs
      tkMsgBox.showinfo('say hello', 'hello world')

      def setupUi(MainDlg, shr_objs = None):
      #setting up all the images and other stuff
      raw_img_good = Image.open('images/good.jpg')
      MainDlg.img_good = ImageTk.PhotoImage(raw_img_good)

      #setting up all the widgets, and if needed, putting pictures to them
      MainDlg.bg = Tk.Label(MainDlg)
      MainDlg.bg.pack(expand=Tk.YES, fill=Tk.BOTH)
      MainDlg.bg['image'] = MainDlg.img_bg

      MainDlg.btnVer = Tk.Button(MainDlg, text='start', command = (lambda: start_click(shr_objs) ) )

      widgets can be arranged using three main geometry managers: pack, grid and place, for this example I chosed pack (the recommended and simplest)

      MainDlg.btnVer.pack()

      MainDlg.btnVer.place(x=620, y=650, width=100, height=40)

      if name == 'main':
      MainDlg = Tk.Tk()
      setupUi(MainDlg, {'action': 'init'})

      MainDlg.mainloop() # for a gui app only enable this, or just run with -i option (interactive mode)

      @

      main.py
      @
      #!/usr/bin/python

      import threading
      import sys, time
      import Gui
      import Tkinter as Tk

      import AA_Tester

      shared queue object

      mqGui2AA = mp.Queue()

      global vars dictionary, I can choose any IPC I want here ..

      shared_objects = {'action': 'init', 'mqGui2AA':mqGui2AA}
      #shared_objects = {'action': 'init'}

      creating main gui form

      MainDlg = Tk.Tk()
      Gui.setupUi(MainDlg, shr_objs = shared_objects)

      shared_objects['MainDlg'] = MainDlg

      AA = AA_Tester.MainAA(shared_objects)

      MainDlg.mainloop()
      @

      partial file from AA_Tester.py
      @
      MainDlg = shr_objs['MainDlg']
      MainDlg.bg['image'] = MainDlg.img_good
      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved