1

I created a Python plugin in QGIS & when i am running my plugin it printing the data on python console. But i want that when i run my plugin it will print the data on QGIS map canvas. How can i do this? Here is my run method which is going to print lat/long per second on Map Canvas. you just tell me how can i get lat/long on Map Canvas instead of printing it in python console. Remember Python version 3.6 QGIS version 3.2 & this code working fine no error

def run(self):
    print('hello')
    """Run method that performs all the real work"""



    PORT_NUMBER = 5000
    SIZE = 1024

    hostName = gethostbyname('192.168.225.140')

    mySocket = socket(AF_INET, SOCK_DGRAM)
    mySocket.bind((hostName, PORT_NUMBER))

    print ("Test server listening on port {0}\n".format(PORT_NUMBER))
    print ("Hi i am linux computer")

    while True:
        (data, addr) = mySocket.recvfrom(SIZE)
        print (data)





    self.dlg.show()
    # Run the dialog event loop
    result = self.dlg.exec_()
    # See if OK was pressed


    if result:
        # Do something useful here - delete the line containing pass and
        # substitute with your code.
        pass

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.