Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8ed095f

Browse files
Projects Added
1 parent cfa4753 commit 8ed095f

File tree

10 files changed

+76
-0
lines changed

10 files changed

+76
-0
lines changed

‎Dice-Simulator/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Dice-Simulator
2+

‎Dice-Simulator/img/five.png

17.8 KB
Loading[フレーム]

‎Dice-Simulator/img/four.png

15.4 KB
Loading[フレーム]

‎Dice-Simulator/img/one.png

11.4 KB
Loading[フレーム]

‎Dice-Simulator/img/six.png

18.1 KB
Loading[フレーム]

‎Dice-Simulator/img/three.png

16.3 KB
Loading[フレーム]

‎Dice-Simulator/img/two.png

13.9 KB
Loading[フレーム]

‎Dice-Simulator/main.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import customtkinter
2+
from PIL import Image
3+
import random
4+
5+
img = ["one", "two", "three", "four", "five", "six"]
6+
def button_callback():
7+
choice = random.choice(img)
8+
my_image = customtkinter.CTkImage(light_image=Image.open("img\\"+choice+".png"),size=(100, 100))
9+
image_label = customtkinter.CTkLabel(app, image=my_image, text="")
10+
image_label.grid(row=1, column=0, padx=20, pady=20)
11+
12+
app = customtkinter.CTk()
13+
app.title("Dice Roll")
14+
app.geometry("350x200")
15+
app.grid_columnconfigure(0, weight=1)
16+
17+
button = customtkinter.CTkButton(app, text="Roll", command=button_callback)
18+
button.grid(row=0, column=0, padx=20, pady=20)
19+
20+
app.mainloop()

‎JSON-to-CSV/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# JSON to CSV
2+
JSON to CSV Converter

‎JSON-to-CSV/json2csv.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import json
2+
import csv
3+
import os
4+
5+
print("\nWelcome to the JSON to CSV converter")
6+
7+
class Converter:
8+
9+
def converter(self, json_file_path, csv_file_name):
10+
global data
11+
if json_file_path == 1:
12+
try:
13+
with open(json_file_path, 'r') as f1:
14+
data = json.load(f1)
15+
except:
16+
print("File not found")
17+
print("Try creating a new json file")
18+
return
19+
20+
if json_file_path == 2:
21+
f = open("input.json",'x')
22+
f.close()
23+
file = "notepad input.json"
24+
os.system(file)
25+
f1 = open("input.json",'r')
26+
data = json.load(f1)
27+
28+
f2 = open(csv_file_name, 'w', newline="")
29+
writer_object = csv.writer(f2)
30+
writer_object.writerow(data[0].keys())
31+
32+
for row in data:
33+
writer_object.writerow(row.values())
34+
f2.close()
35+
36+
choice = input("Do you want open the converted file? (y/n): ")
37+
while choice not in ['y','n']:
38+
print("Invalid choice")
39+
choice = input("Do you want open the converted file? (y/n): ")
40+
if choice == 'y':
41+
os.system(f'start "excel" {csv_file_name}')
42+
43+
json2csv = Converter()
44+
45+
json_file_path = int(input("""
46+
Press (1) to Open an existing json file
47+
Press (2) to Create a new json file and Enter your data
48+
Choose any one: """))
49+
50+
csv_file_name = input("Name your CSV file: ")+".csv"
51+
52+
json2csv.converter(json_file_path, csv_file_name)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /