Python Forum
Entry Widget issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Entry Widget issue
#13
Hi
Thanks for the reply

This is the working code
import serial
from tkinter import *
from time import sleep

   
values = []
root = Tk()
root.geometry('600x200')

cnt=0
var = StringVar()
serialArduino = serial.Serial('COM3',baudrate = 9600, timeout = 1)
root.title("D Cube Serial Read")
e = Entry(root,width = 35, textvariable = var ,borderwidth = 5)
e.grid(row = 0, column = 0, columnspan = 3,padx = 10,pady = 10)
while True:
    valueRead = serialArduino.readline()
    print(valueRead)
    var.set(valueRead)
    #var.set('My Var')
root.mainloop()
You can see the root.mainloop() does not inside the while loop so then the result is showing in the python shell and it does not load the widget and GUI .only reading showing the python shell

b''
b'11\r\n'
b'12\r\n'
b'13\r\n'
b'14\r\n'
b'15\r\n'
b'16\r\n'
b'17\r\n'
b'18\r\n'
b'19\r\n'
Out Put
[Image: s!AvrJlo2hoIofhhrLrGRj7VtNL32k]
but when i put the root.mainloop() to the inside of the while loop as showing following


while True:
    valueRead = serialArduino.readline()
    print(valueRead)
    var.set(valueRead)
    #var.set('My Var')
    root.mainloop()
Then it will load the GUI but the values read from serial port does not display on widget and in this case the value does not show python shell too

See the image

https://1drv.ms/u/s!AvrJlo2hoIofhhuaViWgHjtNjOVe

Please advice
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 983 Mar-06-2024, 08:42 PM
Last Post: russellm44
  [Tkinter] entry widget DPaul 5 1,662 Jul-28-2023, 02:31 PM
Last Post: deanhystad
  Tkinter Exit Code based on Entry Widget Nu2Python 6 3,155 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] canvas widget scroll issue chrisdb 2 3,969 Apr-07-2021, 05:48 AM
Last Post: chrisdb
  method to add entries in multi columns entry frames in self widget sudeshna24 2 2,351 Feb-19-2021, 05:24 PM
Last Post: BashBedlam
  [Tkinter] password with Entry widget TAREKYANGUI 9 6,215 Sep-24-2020, 05:27 PM
Last Post: TAREKYANGUI
  [Tkinter] Get the last entry in my text widget Pedroski55 3 6,549 Jul-13-2020, 10:34 PM
Last Post: Pedroski55
  Date entry in box format issue PeroPuri 6 8,460 Apr-25-2020, 11:03 PM
Last Post: PeroPuri
  How to retreive the grid location of an Entry widget kenwatts275 7 4,816 Apr-24-2020, 11:39 PM
Last Post: Larz60+
  POPUP on widget Entry taratata2020 4 3,853 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