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 :

Callback d'un bouton


Sujet :

Interfaces Graphiques

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Inscrit en
    Avril 2009
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Avril 2009
    Messages : 6
    Par défaut Callback d'un bouton
    Salut,

    C'est mon premier Sujet sur le forum et j'espère pas le dernier

    Bon je suis étudiant en informatique & Multimédia et j'ai un projet sur matlab qui est de réaliser un projet avec une interface graphique permettant le choix des images et l'application de différent filtres et bruits.

    Mon problème en ce moment c'est comment insérer du code sur un bouton dans GUI c'est a dire quand on clique dessus ça fait appel a une fonction ou Quitter !! enfin sa fera une action

    Aider moi dans les brefs délai.

    Merci

  2. #2
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Par défaut
    Bonjour,

    Pour commencer tu devrais lire ceci:
    Introduction à la programmation d'interfaces graphiques

    et celà:
    Développement efficace d'interfaces graphiques

    Ensuite pour qu'on puisse t'aider, il faudrait que tu nous montres ce que tu as commencer à coder et où se situe précisément ton problème ou ton erreur (avec le message correspondant).

    Bonne journée,
    Duf

  3. #3
    Nouveau membre du Club
    Inscrit en
    Avril 2009
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Avril 2009
    Messages : 6
    Par défaut
    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
    95
    function varargout = untitled1(varargin)
    % UNTITLED1 M-file for untitled1.fig
    %      UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
    %      singleton*.
    %
    %      H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
    %      the existing singleton*.
    %
    %      UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in UNTITLED1.M with the given input arguments.
    %
    %      UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before untitled1_OpeningFunction gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to untitled1_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 untitled1
     
    % Last Modified by GUIDE v2.5 28-Apr-2009 10:56:00
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @untitled1_OpeningFcn, ...
                       'gui_OutputFcn',  @untitled1_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 untitled1 is made visible.
    function untitled1_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 untitled1 (see VARARGIN)
     
    % Choose default command line output for untitled1
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes untitled1 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = untitled1_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} = handles.output;
     
     
    % --- 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)
     
     
    % --- If Enable == 'on', executes on mouse press in 5 pixel border.
    % --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton1.
    function pushbutton1_ButtonDownFcn(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)
     
     
    % --- Executes on key press with focus on pushbutton1 and no controls selected.
    function pushbutton1_KeyPressFcn(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)
    Je veux savoir comment insérer du code dans le bouton pour que lorsqu'on clique dessus il fait un effet de filtre sur l'image choisie

  4. #4
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Par défaut
    Il faut ajouter le code dans la fonction liée au Callback de ton bouton (pushbutton1_Callback)

    Citation Envoyé par dragon_clubiste Voir le message
    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 = untitled1(varargin)
    % UNTITLED1 M-file for untitled1.fig
    %      UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
    %      singleton*.
    %
    %      H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
    %      the existing singleton*.
    %
    %      UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in UNTITLED1.M with the given input arguments.
    %
    %      UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before untitled1_OpeningFunction gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to untitled1_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 untitled1
    
    % Last Modified by GUIDE v2.5 28-Apr-2009 10:56:00
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @untitled1_OpeningFcn, ...
                       'gui_OutputFcn',  @untitled1_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 untitled1 is made visible.
    function untitled1_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 untitled1 (see VARARGIN)
    
    % Choose default command line output for untitled1
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    
    % UIWAIT makes untitled1 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = untitled1_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} = handles.output;
    
    
    % --- 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)
    
    disp('Click on button')
    
    function pushbutton1_ButtonDownFcn(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)
    
    
    % --- Executes on key press with focus on pushbutton1 and no controls selected.
    function pushbutton1_KeyPressFcn(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)
    Je veux savoir comment insérer du code dans le bouton pour que lorsqu'on clique dessus il fait un effet de filtre sur l'image choisie

  5. #5
    Nouveau membre du Club
    Inscrit en
    Avril 2009
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Avril 2009
    Messages : 6
    Par défaut
    je n'ai pû aboutir a rien
    SVP faites moi un exemple un bouton qui fait un bruit sur une image

  6. #6
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Par défaut
    Ton problème vient-il de la programmation du bouton ou du bruit sur l'image?

    Quel code as-tu utilisé et quelles sont les erreurs que tu as?

Discussions similaires

  1. une Callback pour deux groupes de boutons ?
    Par Twice22 dans le forum GTK+ avec C & C++
    Réponses: 0
    Dernier message: 04/05/2013, 22h19
  2. Classe Bouton avec callback
    Par flow10000 dans le forum Langage
    Réponses: 8
    Dernier message: 07/10/2012, 01h40
  3. [Débutant] Callback-radio bouton-Push bouton
    Par Allaedine dans le forum Interfaces Graphiques
    Réponses: 4
    Dernier message: 09/03/2012, 20h53
  4. Récupération donnée dans le callback d'un bouton
    Par stick25 dans le forum Interfaces Graphiques
    Réponses: 4
    Dernier message: 15/03/2010, 10h55
  5. problème de handle dans le callback d'un bouton
    Par ZeFMG dans le forum Interfaces Graphiques
    Réponses: 3
    Dernier message: 04/11/2008, 11h48

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