IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Discussion :

Ouverture d'une seconde fenêtre avec passage de variable


Sujet :

Interfaces Graphiques

  1. #1
    Membre habitué Avatar de kawther
    Inscrit en
    Avril 2006
    Messages
    307
    Détails du profil
    Informations personnelles :
    Âge : 40

    Informations forums :
    Inscription : Avril 2006
    Messages : 307
    Points : 143
    Points
    143
    Par défaut Ouverture d'une seconde fenêtre avec passage de variable
    bonsoir, et si je veux passer des variable de la première fenêtre à la deuxième dans mon cas c'est une image comment puis-je le faire.
    merci d'avance.

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonsoir,

    En faisant passer ton image comme un argument normal :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ma_deuxieme_fenetre(monImage);

  3. #3
    Membre habitué Avatar de kawther
    Inscrit en
    Avril 2006
    Messages
    307
    Détails du profil
    Informations personnelles :
    Âge : 40

    Informations forums :
    Inscription : Avril 2006
    Messages : 307
    Points : 143
    Points
    143
    Par défaut
    et comment afficher cette image dans la nouvelle figure en fait j'ai fait un simple
    imshow(img);
    mais ça n'a pas marché

  4. #4
    Invité
    Invité(e)
    Par défaut
    À quel endroit fais-tu cela ?
    Utilises-tu GUIDE ou non ?

  5. #5
    Membre habitué Avatar de kawther
    Inscrit en
    Avril 2006
    Messages
    307
    Détails du profil
    Informations personnelles :
    Âge : 40

    Informations forums :
    Inscription : Avril 2006
    Messages : 307
    Points : 143
    Points
    143
    Par défaut
    en fait j'ai mon interface accueil une autre interface otsu, cette dernière s'affiche en cliquant sur un menu de accueil. puis l'appel à otsu se fait en passant une image comme suit
    otsu(img); et ceci dans le callback de menu.
    maintenant je ne sais pas comment afficher img dans le fichier otsu et comment le déclare. j'ai essayer un simple imshow(img) mais ça n'as pas marché.

  6. #6
    Invité
    Invité(e)
    Par défaut
    Tu ne réponds pas à mes questions, qui dit fonctions callback, dit passage des variables entre les différentes fonctions.
    Ce tutoriel propose 4 façons de faire.
    Si tu utilises GUIDE, ce message pourra aussi t'intéresser.

  7. #7
    Membre habitué Avatar de kawther
    Inscrit en
    Avril 2006
    Messages
    307
    Détails du profil
    Informations personnelles :
    Âge : 40

    Informations forums :
    Inscription : Avril 2006
    Messages : 307
    Points : 143
    Points
    143
    Par défaut
    j'utilise guide. j'ai dans mon interface otsu un axes pour afficher une image à laquelle j'ai déjà fais des traitements dans la fonction accueil. et j'ai aussi deux boutons: keep the original image et save changes.
    l'appel à ma fonction otsu dans accueil se fait comme suit:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    imgres=otsu(img,imgor);
    %imgres:image résultat du chois (j'ai le choix entre garder l'image d'origine te %l'image après modification)
    %img image après le traitement
    ma fonction otsu est la suivante
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    function varargout = otsu(varargin)
    % OTSU M-file for otsu.fig
    %      OTSU, by itself, creates a new OTSU or raises the existing
    %      singleton*.
    %
    %      H = OTSU returns the handle to a new OTSU or the handle to
    %      the existing singleton*.
    %
    %      OTSU('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in OTSU.M with the given input arguments.
    %
    %      OTSU('Property','Value',...) creates a new OTSU or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before otsu_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to otsu_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help otsu
     
    % Last Modified by GUIDE v2.5 06-Nov-2012 04:07:18
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
     
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @otsu_OpeningFcn, ...
                       'gui_OutputFcn',  @otsu_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before otsu is made visible.
    function otsu_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to otsu (see VARARGIN)
     
    % Choose default command line output for otsu
    handles.output = hObject;
    img=varargin{1};
    imgor=varargin{2};
    % Update handles structure
    guidata(hObject, handles);
    axes(handles.axes1);
    imshow(img);
     
    % UIWAIT makes otsu wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
     
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    imgres=imgor;
    close;
     
    % --- Executes on button press in pushbutton2.
    function pushbutton2_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    imgres=img;
    close;
     
    % --- Outputs from this function are returned to the command line.
    function varargout = otsu_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Get default command line output from handles structure
    varargout{1} = imgres;
    mon problème c'est que j'obtiens le message d'erreur suivant:
    Reference to non-existent field 'imgres'.
    
    Error in ==> otsu>otsu_OutputFcn at 94
    varargout{1} = handles.imgres;
    pouvez m'aider SVP

  8. #8
    Invité
    Invité(e)
    Par défaut
    Le message d'erreur ne correspond pas au code présenté
    Si tu as bien fait attention au contenu du tutoriel (§2.3), pour pouvoir utiliser handle.nomVariable, il faut d'abord évidemment le définir :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    handle.nomVariable = ...
    et dans un second temps sauvegarder la structure handles :
    nomVariable à remplacer dans ton cas précis par imgres.

Discussions similaires

  1. [Python 3.X] Ouverture d'une simple fenêtre Tkinter avec Pyzo sur Mac
    Par Leila_A dans le forum Tkinter
    Réponses: 4
    Dernier message: 13/02/2015, 07h49
  2. ouverture d'une pop-pup avec passage d'un paramètre
    Par macalos dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 18/02/2011, 04h37
  3. Créer une seconde fenêtre avec paramètres
    Par schnnic dans le forum Langage
    Réponses: 5
    Dernier message: 24/08/2009, 13h43
  4. Ouverture d'une base Acces avec Builder 6 pro
    Par tryonyco dans le forum C++Builder
    Réponses: 7
    Dernier message: 30/08/2005, 15h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo