Saturday, July 2, 2022

Clear

 For Francophones who would like to work with Python. Very clear:

1. Introduction - Cours de Python (univ-paris-diderot.fr)


Indeed, been thinking I should develop interfaces. With Tkinter, no less...

                                              *     *     *


https://pythonexamples.org/

                                                     *     *     *


import tkinter as tk

class Application(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.creer_widgets()

def creer_widgets(self):

self.label = tk.Label(self, text="J'adore Python !")
self.bouton = tk.Button(self, text="Quitter", command=self.quit)
self.bouton['fg'] = 'red'
self.label.pack()
self.bouton.pack()


if __name__ == "__main__":
app = Application()
app.title("Mon Projet")
app.geometry("600x400+50+50")
app.configure(bg="#ABBCC8")
app.mainloop()

print("C'est fini !")

Here, we are creating an app; and we can use 'self' as a referrent. The app has a title,

the geometry is the dimensions of the new window, and its placement from the edges

of the container window. We quit the app properly and 'c'est fini' appears in the terminal.      



                      

                                                                 *     *     *




Above, coding a combobox, which allows me to have string variables. It is styled

with ttk, which is a more recent module than tk...



No comments: