Python Forum
Entry Widget issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Entry Widget issue
#1
Hi Team
My requirement is read data from arduino through serial port
and put it to the Entry widget

Every this is successful but only issue is The Entry Widget does not open but I can oen it with combine plot widget

Please advice to open Entry widget without plot widget

import serial
from tkinter import *
import matplotlib.pyplot as plt
from drawnow import *

values = []
root = Tk()

plt.ion()
cnt=0

#serialArduino = serial.Serial('/dev/ttyACM0', 19200)
serialArduino = serial.Serial('COM3',baudrate = 9600, timeout = 1)
root.title("D Cube Serial Read")
e = Entry(root,width = 35, borderwidth = 5)
e.grid(row = 0, column = 0, columnspan = 3,padx = 10,pady = 10)
def plotValues():
    plt.title('Serial value from Arduino')
    plt.grid(True)
    plt.ylabel('Values')
    plt.plot(values, 'rx-', label='values')
    plt.legend(loc='upper right')

#pre-load dummy data
for i in range(0,26):
    values.append(0)
    
while True:
    while (serialArduino.inWaiting()==0):
        pass
    valueRead = serialArduino.readline()
    print(valueRead)

    #check if valid value can be casted
    try:
        valueInInt = int(valueRead)
        print(valueInInt)
        
        if valueInInt <= 1024:
            if valueInInt >= 0:
                e.delete(0,END)
                e.insert(1,valueInInt)
                values.append(valueInInt)
                values.pop(0)
                drawnow(plotValues)
                
            else:
                print ("Invalid! negative number")
        else:
            print ("Invalid! too large")
    except ValueError:
        print ("Invalid! cannot cast")
Thanks in advanced
Reply


Messages In This Thread
Entry Widget issue - by PA3040 - Feb-17-2020, 07:15 PM
RE: Entry Widget issue - by Larz60+ - Feb-18-2020, 03:20 AM
RE: Entry Widget issue - by PA3040 - Feb-19-2020, 06:41 PM
RE: Entry Widget issue - by Larz60+ - Feb-19-2020, 08:53 PM
RE: Entry Widget issue - by PA3040 - Feb-20-2020, 05:54 PM
RE: Entry Widget issue - by Larz60+ - Feb-21-2020, 03:35 AM
RE: Entry Widget issue - by PA3040 - Feb-21-2020, 05:33 AM
RE: Entry Widget issue - by Larz60+ - Feb-21-2020, 12:12 PM
RE: Entry Widget issue - by PA3040 - Mar-03-2020, 05:34 AM
RE: Entry Widget issue - by Larz60+ - Mar-03-2020, 08:58 AM
RE: Entry Widget issue - by PA3040 - Mar-04-2020, 01:33 PM
RE: Entry Widget issue - by Larz60+ - Mar-04-2020, 05:39 PM
RE: Entry Widget issue - by PA3040 - Mar-06-2020, 05:15 AM
RE: Entry Widget issue - by Larz60+ - Mar-06-2020, 10:24 AM
RE: Entry Widget issue - by Kurta - Jan-05-2021, 03:02 AM
RE: Entry Widget issue - by deanhystad - Jan-05-2021, 04:20 AM
RE: Entry Widget issue - by pitterbrayn - Jan-20-2021, 02:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ValueError: could not convert string to float: '' fron Entry Widget russellm44 5 1,101 Mar-06-2024, 08:42 PM
Last Post: russellm44
  [Tkinter] entry widget DPaul 5 1,736 Jul-28-2023, 02:31 PM
Last Post: deanhystad
  Tkinter Exit Code based on Entry Widget Nu2Python 6 3,211 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] canvas widget scroll issue chrisdb 2 4,015 Apr-07-2021, 05:48 AM
Last Post: chrisdb
  method to add entries in multi columns entry frames in self widget sudeshna24 2 2,389 Feb-19-2021, 05:24 PM
Last Post: BashBedlam
  [Tkinter] password with Entry widget TAREKYANGUI 9 6,339 Sep-24-2020, 05:27 PM
Last Post: TAREKYANGUI
  [Tkinter] Get the last entry in my text widget Pedroski55 3 6,608 Jul-13-2020, 10:34 PM
Last Post: Pedroski55
  Date entry in box format issue PeroPuri 6 8,519 Apr-25-2020, 11:03 PM
Last Post: PeroPuri
  How to retreive the grid location of an Entry widget kenwatts275 7 4,887 Apr-24-2020, 11:39 PM
Last Post: Larz60+
  POPUP on widget Entry taratata2020 4 3,911 Mar-10-2020, 05:04 PM
Last Post: taratata2020

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020