You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
649 B
21 lines
649 B
from tkinter import *
|
|
|
|
def conversion():
|
|
decimal_number = float(value.get()) # Conversion en nombre décimal
|
|
hex_number = format(int(decimal_number), 'x') # Conversion en hexadécimal
|
|
label.config(text=f"Hexadécimal: {hex_number.upper()}") # Affichage du résultat en majuscules
|
|
|
|
fenetre = Tk()
|
|
fenetre.title("Conversion Décimal en Hexadécimal")
|
|
|
|
value = StringVar(value="0")
|
|
|
|
Label(fenetre, text="Entrez un nombre décimal:").pack()
|
|
Entry(fenetre, textvariable=value, width=30).pack()
|
|
Button(fenetre, text="Convertir", command=conversion).pack()
|
|
label = Label(fenetre, text="Hexadécimal : ")
|
|
label.pack()
|
|
|
|
fenetre.mainloop()
|
|
|
|
|
|
|