Refreshing the Mainwindow (Tk)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arepi
    New Member
    • Sep 2008
    • 62

    Refreshing the Mainwindow (Tk)

    Hi!

    I read data from COM and I want them show in widgets of Mainwindow. From the
    subrutin whereabouts I read , I go back to the Mainwindow . How can I fast and automatically go back to the read subrutin.(the repeat function is to slow->1ms). Presently I runnig 2 scripts paralell and push the data to Mainwindow with a PIPE, but I want this make with only 1 Srcipt. How can I do this?

    Thanks!
    Last edited by Arepi; Sep 21 '08, 03:26 PM. Reason: failed word
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Wow! That was a heck of an explanation that was really confusing, sorry. Without your code and a much clearer explanation of your issue, we won't be able to help you.

    Why not post your code (enclosed in code tags, that way we can take a look at it and try and help you.

    Regards,

    Jeff

    Comment

    • Arepi
      New Member
      • Sep 2008
      • 62

      #3
      Thanks!

      which code send I? The 2 what I run now or, it the 1what I want but I need yours help?

      Comment

      • Arepi
        New Member
        • Sep 2008
        • 62

        #4
        Well, I try to demostrate the problem during the next simplidied example


        Code:
        use Win32::SerialPort 0.09;
        use Tk;	
        
        $mw=MainWindow->new();	
        
        $mw->maxsize(600,470);								
        $mw->minsize(600,470);
        
        ###########################  widgets #######################x
        $d1=0.000;
        	$e1=$mw->Entry(-width => 10,			
        				   -textvariable => \$d1);	#here iwant display the data from port		
        	$e1->place(-x =>100, -y =>100);	
        	
        	
        $g2 = $mw->Button(-text => "Start read",					
        				  -command => sub{ &read}   #here i start the first read
        								);
        $g2->place(-x => 240, -y => 100);
        ######################### Port Object#########################
        unless ($soros_port = Win32::SerialPort->new ('com1')) {
            printf "Nem tudtam megnyitni a soros portot!\n";
            exit 1;
        	
        $soros_port->baudrate(9600)		|| die "rossz BAUD";
        $soros_port->parity('even')		|| die "rossz Parias";
        $soros_port->databits(8)		|| die "rossz Adatbit";
        $soros_port->stopbits(1)		|| die "rossz Stopbit";
        $soros_port->buffers(4096,4096)	|| die "rossz Buffer";
        $soros_port->handshake("none")	|| die "rossz Handshake";
        ##########################################################	
        MainLoop();
        
        sub read  #the function go back whit the data  freshing the $e1 widgets
        	{
        		while(1)
        			{
        			($count_in, $d1)	= $soros_port->read(1) or die "itten"; 
        				if($count_in!=0) {last;}
        			}
        	}
        ###########################################################
        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
        Last edited by Arepi; Sep 21 '08, 05:06 PM. Reason: tags

        Comment

        Working...