Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import os
- import subprocess
- import requests
- import json
- import tkinter as tk
- def load_configuration():
- conf = open('config.json')
- config = json.load(conf)
- conf.close()
- return config
- def save_configuration():
- conf = open('config.json', 'w')
- json.dump(new_configuration, conf)
- conf.close()
- def create_configuration():
- conf = open('config.json', 'w')
- json.dump(start_configuration, conf)
- conf.close()
- def english_menu():
- main_menu = tk.Menu(root)
- root.config(menu=main_menu)
- theme_menu = tk.Menu(main_menu)
- theme_menu.add_command(label='Dark')
- theme_menu.add_command(label='Light')
- language_menu = tk.Menu(main_menu)
- language_menu.add_command(label='English', command=lambda:(current_configuration['language'] == 'English', new_configuration['language'] == 'English', print(new_configuration)))
- language_menu.add_command(label='Russian', command=lambda:(current_configuration['language'] == 'Russian', new_configuration['language'] == 'Russian', print(new_configuration)))
- main_menu.add_cascade(label='Theme', menu=theme_menu)
- main_menu.add_cascade(label='Language', menu=language_menu)
- def russian_menu():
- main_menu = tk.Menu(root)
- root.config(menu=main_menu)
- theme_menu = tk.Menu(main_menu)
- theme_menu.add_command(label='Тёмная')
- theme_menu.add_command(label='Светлая')
- language_menu = tk.Menu(main_menu)
- language_menu.add_command(label='Анлглийский', command=lambda:(current_configuration['language'] == 'English', new_configuration['language'] == 'English', print(new_configuration)))
- language_menu.add_command(label='Русский', command=lambda:(current_configuration['language'] == 'Russian', new_configuration['language'] == 'Russian', print(new_configuration)))
- main_menu.add_cascade(label='Тема', menu=theme_menu)
- main_menu.add_cascade(label='Язык', menu=language_menu)
- start_configuration = {
- 'language': 'Russian',
- 'theme': 'Dark',
- 'location': 'Russia',
- }
- new_configuration = {
- }
- try:
- load_configuration()
- current_configuration = load_configuration()
- except FileNotFoundError:
- create_configuration()
- current_configuration = load_configuration()
- root = tk.Tk()
- if current_configuration['language'] == 'English':
- english_menu()
- elif current_configuration['language'] == 'Russian':
- russian_menu()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement