commit
bd2be173e2
1 changed files with 21 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||
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() |
|||
|
|||
|
Loading…
Reference in new issue