Coding_tuts

Coding_tuts

Programming tutorials

Python Write in file and read from file

file open("yourfilename.txt", "a") file.write(  str(your_variable)) file.close() file = open("youfilename.txt", "r") print(file.read())

SlashReal 1 minute read 6 Apr 2023 0 comments $0.00

Python count seconds

import time counter = 0 while 0 < 1:     seconds = time.time()     local_time = time.ctime(seconds)     counter = counter +1     print('Seconds: ' , counter)     time.sleep(1)

SlashReal 1 minute read 5 Apr 2023 0 comments $0.00

Python show messagebox

from tkinter.messagebox import showinfo  message = 'my message' showinfo(                title='my title'                 message = message               )

SlashReal 1 minute read 4 Apr 2023 0 comments $0.00

Change Label text Python

label = ttk.Label(root, text='My Label') label.pack(ipadx=10, ipady=15) label.config(text='text changed')

SlashReal 1 minute read 24 Mar 2023 0 comments $0.00

How to make a button with Python

#If you have read the simple GUI tutorial def mybutton_Clicked():        print('Button Clicked myButton = ttk.Button(root, text='My Button', command= myButton_Clicked) myButton.pack(ipadx=10, ipady=30, expand=True)

SlashReal 1 minute read 22 Mar 2023 0 comments $0.00

How to make a simple GUI with Python

import tkinter as tk from tkinter import ttk root = tk.Tk() root.geometry('300x200') root.title('My GUI') root.mainloop()

SlashReal 1 minute read 22 Mar 2023 0 comments $0.01

Chō - Han

Chō - Han  import random  ranum = int(random.uniform(1, 6)) ranum2 = int(random.uniform(1, 6)) erg = ranum + ranum2 rest = erg % 2 if rest == 1:     print('Han') else:       print('Chō')   Thats a japanese gambling game. 

SlashReal 1 minute read 21 Mar 2023 0 comments $0.00