I've posted this problem before but I didn't get much back so I'll try again.
Heres the code:
#Create the Main Window
$mw = MainWindow->new;
#Create the frame to display the images
$frame2 = $mw->Frame(-background=>'black',-width=>712,-height=>568)->pack(-anchor=>'ne');
#Load the images
$wittitle = $mw->Photo('23',-file => "images/subtitle.jpg"
;
$mainimage = $mw->Photo('22',-file => "images/viv5.jpg"
;
$games = $mw->Photo('44',-file => "images/games.jpg"
;
$apps = $mw->Photo('45',-file => "images/apps.jpg"
;
#The above image handles are put in a array. Each time a button is pressed, it cycles through this array, setting the $image below to a image handle in the array
$program_image = $frame2->Label('-image'=>$image, -borderwidth=>0)->place(-x=>0,-y=>0);
The way the program works:
program calls a function
function creates a new mainwindow
loads all the images
setups a button to cycle through them
user hits a exit button
destroys the mainwindow
exits function
returns to main screen
user can call the function again - if they do, this is where the memory usage grows as the user exits and enters the function repeatedly(have to allow this).
Problem: when it exits the function, it doesn't free up the memory used by the images.
Solution:?? This is only a problem since the latest version of either Tk or TK::JPEG - don't know which and I can't find the older versions of them, to test them.
If you need more info let me know
Thanx
StevoIE
Heres the code:
#Create the Main Window
$mw = MainWindow->new;
#Create the frame to display the images
$frame2 = $mw->Frame(-background=>'black',-width=>712,-height=>568)->pack(-anchor=>'ne');
#Load the images
$wittitle = $mw->Photo('23',-file => "images/subtitle.jpg"
$mainimage = $mw->Photo('22',-file => "images/viv5.jpg"
$games = $mw->Photo('44',-file => "images/games.jpg"
$apps = $mw->Photo('45',-file => "images/apps.jpg"
#The above image handles are put in a array. Each time a button is pressed, it cycles through this array, setting the $image below to a image handle in the array
$program_image = $frame2->Label('-image'=>$image, -borderwidth=>0)->place(-x=>0,-y=>0);
The way the program works:
program calls a function
function creates a new mainwindow
loads all the images
setups a button to cycle through them
user hits a exit button
destroys the mainwindow
exits function
returns to main screen
user can call the function again - if they do, this is where the memory usage grows as the user exits and enters the function repeatedly(have to allow this).
Problem: when it exits the function, it doesn't free up the memory used by the images.
Solution:?? This is only a problem since the latest version of either Tk or TK::JPEG - don't know which and I can't find the older versions of them, to test them.
If you need more info let me know
Thanx
StevoIE