Skip to content

Commit

Permalink
VER 1.1.6
Browse files Browse the repository at this point in the history
-- Add welcome text.
 : On the number label.
-- Add changing number.
 : Click to make the number change constantly until click again.
*# Make the language files to adapt the program.
  • Loading branch information
ren-yc committed Mar 12, 2022
1 parent d9849ac commit 8323952
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
31 changes: 22 additions & 9 deletions RandomRollCall.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import webbrowser
import random
from numpy import False_
import yaml
import os
import sys
import tkinter as tk
from time import sleep
from tkinter.messagebox import showerror, showinfo
from tkinter.simpledialog import askinteger, askstring

# Init
root = tk.Tk()
supported_lang = ["en-Us", "zh-Hans"]
running = False

# Error
def errno_1():
Expand Down Expand Up @@ -58,6 +61,7 @@ def errno_3():
Lang_Please_Reopen = dic['Reopen']
Lang_Error = dic['Error']
Lang_Switch_Error_Message = dic['Switch_Lang_Error']
Lang_Window_Info = dic['Window_Info']
file.close()
except:
errno_2()
Expand Down Expand Up @@ -118,6 +122,8 @@ def Show_About():

def Ask_Lang():
tmp = askstring(title = Lang_Menu_Lang, prompt = Lang_Switch)
if tmp == None:
return
if not tmp in supported_lang:
showerror(title = Lang_Error, message = Lang_Switch_Error_Message)
else:
Expand Down Expand Up @@ -146,15 +152,22 @@ def Ask_Lang():
root.iconbitmap("RandomRollCall.ico")

# Mainloop
def label_click_handler(events):
selected = random.randint(minnum, maxnum)
label_obj1.config(font = 'Helvetica -%d bold' % FrontSize(selected))
label_obj1['text'] = selected
def click(events):
global running
if running == False:
running = True
while running == True:
selected = random.randint(minnum, maxnum)
big_num_label.config(font = 'Helvetica -%d bold' % FrontSize(selected))
big_num_label['text'] = selected
big_num_label.update()
sleep(0.01)
else:
running = False

# Show
selected = random.randint(minnum, maxnum)
label_obj1 = tk.Label(root, text = selected, width = 380, height = 380)
label_obj1.config(font = 'Helvetica -%d bold' % FrontSize(selected))
label_obj1.bind("<Button-1>", label_click_handler)
label_obj1.pack(side = tk.LEFT)
big_num_label = tk.Label(root, text = Lang_Window_Info, width = 380, height = 380)
big_num_label.config(font = 'Helvetica -%d bold' % 100)
big_num_label.bind("<Button-1>", click)
big_num_label.pack(side = tk.LEFT)
root.mainloop()
3 changes: 2 additions & 1 deletion lang/en-Us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Switch_Lang: "Switch language..."
Switch_Info: "Please enter the language code you need to switch to, it currently supports zh-Hans en-Us."
About_Message: "This program uses MIT License\nDeveloper: Class Tools Develop Team - Yuchen Ren\nGithub Repository: https://github.com/class-tools/RandomRollCall\nVersion "
Error: "Error"
Switch_Lang_Error: "Unsupported language."
Switch_Lang_Error: "Unsupported language."
Window_Info: "Start"
3 changes: 2 additions & 1 deletion lang/zh-Hans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Switch_Lang: "更改语言..."
Switch_Info: "请输入你想要切换至的语言代号,目前支持 zh-Hans en-Us。"
About_Message: "本程序使用 MIT 许可证\n开发者 Class Tools Develop Team - Yuchen Ren\nGithub 存储库:https://github.com/class-tools/RandomRollCall\n版本 "
Error: "错误"
Switch_Lang_Error: "不支持的语言。"
Switch_Lang_Error: "不支持的语言。"
Window_Info: "开始"

0 comments on commit 8323952

Please sign in to comment.