Je suis complètement nouveau à Perl/Tk et j'essaie de créer une application qui nécessite plusieurs menus déroulants. J'utilise des menus d'options pour cela. Mais lorsque je change la valeur d'un menu d'options en cours d'exécution, la valeur de toutes les listes déroulantes change pour cette valeur. S'il vous plaît aider dans ceci. Voici le code:Utilisation de plusieurs menus d'options en Perl/Tk
#!/usr/bin/perl
use warnings;
use Tk;
my $mw = MainWindow->new;
$mw->geometry("700x700");
$mw->title("AIR (Auto Immune Research)");
#create own title font
$mw->fontCreate("sectionTitleFont", -family => "Helvetica", -size => 36, -weight => "bold");
my $symptomFrame = $mw->Frame(-background => 'white', -foreground => 'black')->pack(-side => "top", -fill => "x");
my $pathologyFrame = $mw->Frame(-background => 'white', -foreground => 'black')->pack(-side => "bottom", -fill => "x");
my $symptomLabel = $symptomFrame->Label(-background => 'white', -text => 'Patient Symptoms', -font => 'sectionTitleFont');
my $pathologyLabel = $pathologyFrame->Label(-background => 'white', -text => 'Pathological Findings', -font => 'sectionTitleFont');
my $severityText = $symptomFrame->Label(-background => 'white', -text => 'Severity on a scale of 1 to 10');
#cough
my $coughCheckBox = $symptomFrame->Checkbutton(-text => 'Cough', -background => 'white');
my $coughSeverity;
my $coughSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$coughSeverity,
-textvariable => \$severityText
);
#Fever
my $feverCheckBox = $symptomFrame->Checkbutton(-text => 'Fever', -background => 'white');
my $feverSeverity;
my $feverSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$feverSeverity,
-textvariable => \$severityText
);
#joint pain
my $jointPainCheckBox = $symptomFrame->Checkbutton(-text => 'Joint Pain', -background => 'white');
my $jointPainSeverity;
my $jointPainSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$jointPainSeverity,
-textvariable => \$severityText
);
#Moon face
my $moonFaceCheckBox = $symptomFrame->Checkbutton(-text => 'Moon Face', -background => 'white');
my $moonFaceSeverity;
my $moonFaceSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$moonFaceSeverity,
-textvariable => \$severityText
);
#fatigue
my $fatigueBox = $symptomFrame->Checkbutton(-text => 'Fatigue', -background => 'white');
my $fatigueSeverity;
my $fatigueSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$fatigueSeverity,
-textvariable => \$severityText
);
#Skin Redness
my $skinRednessBox = $symptomFrame->Checkbutton(-text => 'Skin Redness', -background => 'white');
my $skinRednessSeverity;
my $skinRednessSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$skinRednessSeverity,
-textvariable => \$severityText
);
#Drowsiness
my $drowsinessBox = $symptomFrame->Checkbutton(-text => 'Drowsiness', -background => 'white');
my $drowsinessSeverity;
my $drowsinessSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$drowsinessSeverity,
-textvariable => \$severityText
);
#Headache
my $headacheBox = $symptomFrame->Checkbutton(-text => 'Headache', -background => 'white');
my $headacheSeverity;
my $headacheSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$headacheSeverity,
-textvariable => \$severityText
);
#Inflamations
my $inflamationsBox = $symptomFrame->Checkbutton(-text => 'Inflamations', -background => 'white');
my $inflamationsSeverity;
my $inflamationsSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$inflamationsSeverity,
-textvariable => \$severityText
);
#Itchiness
my $itchinessBox = $symptomFrame->Checkbutton(-text => 'Itchiness', -background => 'white');
my $itchinessSeverity;
my $itchinessSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$itchinessSeverity,
-textvariable => \$severityText
);
#Blood in Urine
my $bloodBox = $symptomFrame->Checkbutton(-text => 'Blood in Urine', -background => 'white');
my $bloodSeverity;
my $bloodSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$bloodSeverity,
-textvariable => \$severityText
);
#Depression
my $depressionBox = $symptomFrame->Checkbutton(-text => 'Depression', -background => 'white');
my $depressionSeverity;
my $depressionSeverityDD = $symptomFrame->Optionmenu(
-options => [[1=>1], [2=>2], [3=>3], [4=>4], [5=>5], [6=>6], [7=>7], [8=>8], [9=>9], [10=>10]],
-variable => \$depressionSeverity,
-textvariable => \$severityText
);
#emty label to give empty space
my $emptyLabel = $symptomFrame->Label(-background => 'white', -width => '20');
$symptomLabel->grid(-columnspan => '5');
$pathologyLabel->grid(-columnspan => '5');
#$severityText->grid;
$coughCheckBox -> grid($coughSeverityDD, $emptyLabel, $feverCheckBox, $feverSeverityDD);
$jointPainCheckBox -> grid($moonFaceSeverityDD, $emptyLabel, $depressionBox, $depressionSeverityDD);
$moonFaceCheckBox -> grid($jointPainSeverityDD, $emptyLabel, $bloodBox, $bloodSeverityDD);
MainLoop;
Vous devez indiquer au moins le code que les utilisateurs de la pile peuvent utiliser pour exécuter et reproduire le problème. –
Oui. Comme Chris l'a mentionné ci-dessus, veuillez fournir le code Perl/Tk entier - ou au moins certains qui sont exécutables - afin que nous puissions vous aider. Par exemple, $ symptomFrame n'est pas défini ci-dessus, donc nous ne pouvons pas vraiment exécuter ce que vous nous avez fourni. Merci. – tale852150
Bonjour, j'ai mis à jour le code. Jetez un coup d'oeil s'il vous plait. –