473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Refresh widget

62
I try port reading and displaying in widgets.Well, I try to demostrate the problem during the next simplified example:



Expand|Select|Wrap|Line Numbers
  1.  1. use Win32::SerialPort 0.09;
  2.    2. use Tk;
  3.    3.  
  4.    4. $mw=MainWindow->new();
  5.    5.  
  6.    6. $mw->maxsize(600,470);
  7.    7. $mw->minsize(600,470);
  8.    8.  
  9.    9. ########################### widgets #######################x
  10.   10. $d1=0.000;
  11.   11. $e1=$mw->Entry(-width => 10,
  12.   12. -textvariable => \$d1); #here iwant display the data from port
  13.   13. $e1->place(-x =>100, -y =>100);
  14.   14.  
  15.   15.  
  16.   16. $g2 = $mw->Button(-text => "Start read",
  17.   17. -command => sub{ &read} #here i start the first read
  18.   18. );
  19.   19. $g2->place(-x => 240, -y => 100);
  20.   20. ######################### Port Object#########################
  21.   21. unless ($soros_port = Win32::SerialPort->new ('com1')) {
  22.   22. printf "Nem tudtam megnyitni a soros portot!\n";
  23.   23. exit 1;
  24.   24.  
  25.   25. $soros_port->baudrate(9600) || die "rossz BAUD";
  26.   26. $soros_port->parity('even') || die "rossz Parias";
  27.   27. $soros_port->databits(8) || die "rossz Adatbit";
  28.   28. $soros_port->stopbits(1) || die "rossz Stopbit";
  29.   29. $soros_port->buffers(4096,4096) || die "rossz Buffer";
  30.   30. $soros_port->handshake("none") || die "rossz Handshake";
  31.   31. ################################################## ########
  32.   32. MainLoop();
  33.   33.  
  34.   34. sub read #the function go back whit the data freshing the $e1 widgets
  35.   35. {
  36.   36. while(1)
  37.   37. {
  38.   38. ($count_in, $d1) = $soros_port->read(1) or die "itten";
  39.   39. if($count_in!=0) {last;}
  40.   40. }
  41.   41. }
  42.   42. ################################################## #########
  43.  
How can after the return of " sub read" (so refreshing the widget)
fast and automatically call the "sub read" again and again?->so can I continous displaying the data from port (the repeat are to slow->1ms)
Sep 22 '08 #1
1 1598
Icecrack
174 Expert 100+
i will have to try your code when i get home from work, as i do not have the equipment here to do it.
Sep 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Srinath Avadhanula | last post by:
Hello, Sorry to be bringing up what seems to be a somewhat beaten up topic... This is what I wanted to do: Create a _simple_ text editor widget which supports VI(M) style keybindings but...
0
by: Stewart Midwinter | last post by:
I've got a Tkinter app that draws three histograms. At this point I am simulating real data by drawing rectangles whose size is defined by random numbers; in the future there would be real data...
2
by: Tonino | last post by:
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the...
6
by: William Gill | last post by:
I am trying to get & set the properties of a widget's parent widget. What I have works, but seems like a long way around the block. First I get the widget name using w.winfo_parent(), then i...
0
by: William Gill | last post by:
I have a Tkinter (frame) widget that contains several other frame widgets, each containing entry widgets. In the parent frame I have a 'save' button that is initially disabled. As it is now, each...
2
by: Arne Meissner | last post by:
Hello! Is there a function to update/refresh a listbox widget. My one is connected to a database and after a change of the database I would like the listbox to be updated. Thank you for your...
0
by: Tim N. van der Leeuw | last post by:
Hi, I need to display some hierarchical data, and because I don't want to force users to install too many things beyond Python itself, I'm hoping to use Tix which is at least included with...
3
by: mariox19 | last post by:
Are Tkinter widgets running on their own thread? If I try to make a simple application that will print the letters A to Z to a Tkinter Text widget, and I space the printing of each letter by 1...
0
by: Phil Thompson | last post by:
On Sunday 04 May 2008, Lance Gamet wrote: I think QMainWindow.setCentralWidget() is what you are looking for. The eric4 IDE probably covers most things you'll ever need. Phil
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.