Bouton activé sans clic, de classe à classe
Bonjour
Il y a un problème d'exécution instantanée dans ce code
Le "print" s'exécute sans aucune intervention de l'utilisateur
Code:
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
| # !/usr/bin/env python 3.5
# -*- coding: utf-8 -*-
from tkinter import *
class Gammic(Tk):
def __init__(self):
Tk.__init__(self)
self.title(' :')
self.ccc = None
self.btc = Button(self, text='Comic', width=15, command=self.comic)
self.btc.pack()
def comic(self):
if self.ccc is not None:
self.ccc.destroy()
self.ccc = Toplevel(self)
self.ccc.geometry('600x666')
self.btc2 = Button(self.ccc, text='Comic2', width=15, command=Gam2.brnch(self))
self.btc2.pack()
class Gam2(Gammic):
def __init__(self):
Gammic.__init__(self)
def brnch(self):
print('o')
Gammic().mainloop() |