Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question window
#1
Hello, i have python 3.4.3, is it normal when i run this module, nothing happens ?
It is not supposed to create a window ?


# -*- coding: utf-8 -*-
import tkinter


class View :
    def __init__(self,texte="Hello"):
        fenetre = tkinter.Tk()
        fenetre.title("First exemple")
        lbl_message = tkinter.Label(fenetre, 
                           text=texte,
                           fg="red")
        lbl_message.pack()
        btn_quitter = tkinter.Button(fenetre, 
                            text="Goodbye",
                            command = fenetre.destroy) 
        btn_quitter.pack()
        fenetre.mainloop()


if __name__ == '__main__' :
    mon_appli = View("I hope you have a good holiday")
Reply
#2
It works fine on my system
It does create a small window

How exactly did you run it?
python version
os
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020