How to create a list and append to list inside a mqtt and GUI program?

2019-09-01 Thread Spencer Du
Hi I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a GUI file if the file exists in current directory. I want to add the file name to a list when a file is imported and for each subsequent file that is imported I want the file name to be imported to the same list an

Hi how do I import files inside a txt file?

2019-09-02 Thread Spencer Du
Hi How do i import files inside a txt file if they exist in the current directory? Here is the current code but I dont know how to do it correctly. import paho.mqtt.client as mqtt from mqtt import * import importlib import os import os.path # from stateMachine import * with open("list_of_device

Re: Hi how do I import files inside a txt file?

2019-09-02 Thread Spencer Du
On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote: > Spencer Du writes: > > > How do i import files inside a txt file if they exist in the current > > directory? > > > > Here is the current code but I dont know how to do it correctly. > >

Re: Hi how do I import files inside a txt file?

2019-09-02 Thread Spencer Du
On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote: > Spencer Du writes: > > > How do i import files inside a txt file if they exist in the current > > directory? > > > > Here is the current code but I dont know how to do it correctly. > >

Re: Hi how do I import files inside a txt file?

2019-09-02 Thread Spencer Du
On Monday, 2 September 2019 15:03:52 UTC+2, Joel Goldstick wrote: > On Mon, Sep 2, 2019 at 8:46 AM Spencer Du wrote: > > > > On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote: > > > Spencer Du writes: > > > > > > > How do i import

Re: Hi how do I import files inside a txt file?

2019-09-02 Thread Spencer Du
On Monday, 2 September 2019 15:29:07 UTC+2, Joel Goldstick wrote: > On Mon, Sep 2, 2019 at 9:21 AM Spencer Du wrote: > > > > On Monday, 2 September 2019 15:03:52 UTC+2, Joel Goldstick wrote: > > > On Mon, Sep 2, 2019 at 8:46 AM Spencer Du wrote: > > > > &g

Help needed urgently for running some code!!!!

2019-09-02 Thread Spencer Du
Hi I want to execute "from devicesEmbedded import *": in GUI.py after all code in GUI.py is run. Also how do I make the devicesEmbedded.py reload and run when a txt file is created in the name of "list_of_devices.txt" in the GUI.py python program. GUI.py import logging from datetime import

Help needed to run some code!!!!

2019-09-02 Thread Spencer Du
Hi How can I execute "from devicesEmbedded import *" after this: "print("Device added to list")" in GUI.py because currently if I have the import added at the top of GUI.py file it always executes first before the GUI.py file is executed. I want the devicesEmbedded.py to execute after GUI.py ha

How to remove a string from a txt file?

2019-09-04 Thread Spencer Du
Hi I want to remove a string from a txt file and then print out what I have removed. How do I do this. The txt file is in this format and should be kept in this format. txt.txt: laser,cameras, Thanks -- https://mail.python.org/mailman/listinfo/python-list

Help me fix a problem

2019-09-06 Thread Spencer Du
Hi I want to print yes in gui.py but it does not get printed because of the json. How do I fix this. Execute embedded.py and then gui.py to test. embedded.py import paho.mqtt.client as mqtt from mqtt import * client = mqtt.Client() client.connect("broker.hivemq.com",1883,60) client.on_connec

Re: Help me fix a problem

2019-09-06 Thread Spencer Du
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote: > On 2019-09-06 18:11, Spencer Du wrote: > > Hi > > > > I want to print yes in gui.py but it does not get printed because of the > > json. How do I fix this. Execute embedded.py and then gui.py to test. >

Re: Help me fix a problem

2019-09-06 Thread Spencer Du
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote: > On 2019-09-06 18:11, Spencer Du wrote: > > Hi > > > > I want to print yes in gui.py but it does not get printed because of the > > json. How do I fix this. Execute embedded.py and then gui.py to test. >

Re: Help me fix a problem

2019-09-06 Thread Spencer Du
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote: > On 2019-09-06 18:11, Spencer Du wrote: > > Hi > > > > I want to print yes in gui.py but it does not get printed because of the > > json. How do I fix this. Execute embedded.py and then gui.py to test. >

Why is "Subscribing to topic topic/test" printed in console log before connect message?

2019-09-10 Thread Spencer Du
Hi I have code for publish and subscribe over mqtt. In the console log I have "Subscribing to topic topic/test" printed before connect message why is this? I want to this to be printed after the connect message. How do I fix this problem. Please run gui.py to test. gui.py import paho.mqtt.cl

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-26 Thread Spencer Du
Hi How do I publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value. Thanks # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'laser.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this fi

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-27 Thread Spencer Du
Hi When the values of the spinboxes is set a message should be published from the GUI containing the value from the spinbox which then sets the qlabel with the value. After this if I close and reload the gui the widgets should be set with the values set from the previous time. When the embedded

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-27 Thread Spencer Du
Hi When the values of the spinboxes is set a message should be published from the GUI containing the value from the spinbox which then sets the qlabel with the value. After this if I close and reload the gui the widgets should be set with the values set from the previous time. When the embedde

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-27 Thread Spencer Du
Hi When the values of the spinboxes is set a message should be published from the GUI containing the value from the spinbox which then sets the qlabel with the value. After this if I close and reload the gui the widgets should be set with the values set from the previous time. When the embedde

How to publish a message of the qspinbox value when the qspinbox sets the slider with corresponding value.

2019-09-27 Thread Spencer Du
Hi When the values of the spinboxes is set a message should be published from the GUI containing the value from the spinbox which then sets the qlabel with the value. After this if I close and reload the gui the widgets should be set with the values set from the previous time. When the embe

How can I set the value of the textedit box and slider of ui with the value from a config file when it has been created?

2019-10-01 Thread Spencer Du
Hi How can I set the value of the textedit box and slider of ui with the value from a config file when it has been created meaning if a configuration file exists then set the UI with value from the config file otherwise load ui with nothing set to any value. ui.py import sys from PyQt5.QtWidgets

How execute at least two python files at once when imported?

2019-11-05 Thread Spencer Du
Hi I want to execute at least two python files at once when imported but I dont know how to do this. Currently I can only import each file one after another but what i want is each file to be imported at the same time. Can you help me write the code for this? embedded.py is the main file to exe

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
On Wednesday, 6 November 2019 09:05:42 UTC+1, Christian Gollwitzer wrote: > Am 06.11.19 um 03:59 schrieb Dennis Lee Bieber: > > On Tue, 5 Nov 2019 10:33:20 -0800 (PST), Spencer Du > > declaimed the following: > > > >> Hi > >> > >> I want t

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
On Tuesday, 5 November 2019 19:37:32 UTC+1, Karsten Hilbert wrote: > > I want to execute at least two python files at once when imported but I > > dont know how to do this. > > Currently I can only import each file one after another but what i want is > > each file to be imported > > at the same

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
On Tuesday, 5 November 2019 21:05:02 UTC+1, Terry Reedy wrote: > On 11/5/2019 1:33 PM, Spencer Du wrote: > > > I want to execute at least two python files at once when imported but I > > dont know how to do this. Currently I can only import each file one after > > an

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
On Tuesday, 5 November 2019 19:41:59 UTC+1, Bob Gailer wrote: > On Nov 5, 2019 1:35 PM, "Spencer Du" wrote: > > > > Hi > > > > I want to execute at least two python files at once when imported but I > dont know how to do this. Currently I can only import

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
On Tuesday, 5 November 2019 19:44:46 UTC+1, Rhodri James wrote: > On 05/11/2019 18:33, Spencer Du wrote: > > I want to execute at least two python files at once when imported but > > I dont know how to do this. Currently I can only import each file one > > after another bu

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
Why is importing modules in parallel bad? Thanks Spencer -- https://mail.python.org/mailman/listinfo/python-list

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Spencer Du
Hi Sorry if I haven't stated my requirements clearly. I just wanted a way to import at least two python files in parallel and I wanted to know how this can be done or a reason why its bad as stated in another post. Thanks Spencer -- https://mail.python.org/mailman/listinfo/python-list

How do i execute some code when I have subscribed to a topic with a message payload for mqtt in python?

2019-08-08 Thread Spencer Du via Python-list
Ok so here is some code below. How do I write an if code block to execute some commands when I subscribe to the topic: microscope/light_sheet_microscope/UI and which has a message which is a device type published to it. I want to execute some code to check if the device has a python file in the

Re: How do i execute some code when I have subscribed to a topic with a message payload for mqtt in python?

2019-08-08 Thread Spencer Du via Python-list
On Thursday, 8 August 2019 22:48:11 UTC+2, Spencer Du wrote: > Ok so here is some code below. How do I write an if code block to execute > some commands when I subscribe to the topic: > microscope/light_sheet_microscope/UI and which has a message which is a > device type publis

How do I decouple these two modules?

2019-08-28 Thread Spencer Du via Python-list
Hi I have code for a GUI and MQTT. How do I make both of these modules decoupled because currently they rely on each other to some extent. GUI.py import logging from datetime import timedelta import time from thespian.actors import * from transitions import Machine import paho.mqtt.client as mq

How to create list for stuff inside mqtt and GUI?.

2019-09-01 Thread Spencer Du via Python-list
Hi I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a GUI file if the file exists in current directory. I want to add the file name to a list when a file is imported and for each subsequent file that is imported I want the file name to be imported to the same list an