Advertisement
DerioFT

Layout Kalkulator 2

Feb 26th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.65 KB | None | 0 0
  1. import tkinter as tk
  2. from math import sqrt
  3.  
  4. class Page01(tk.Frame):
  5.  
  6.     def __init__(self, parent, AppSettings):
  7.         self.settings = AppSettings
  8.        
  9.         super().__init__(parent)
  10.         self.configure(bg="white")
  11.         self.pack(fill="both", expand=True)
  12.  
  13.         #CREATE FRAMES
  14.         self.create_frame01()
  15.         self.create_frame02()
  16.         self.create_frame03()
  17.  
  18.  
  19.     def create_frame01(self):  
  20.         self.frame01 = tk.Frame(self, bg="black", height=self.settings.height//3)
  21.         self.frame01.pack(fill="x")
  22.  
  23.     def create_frame02(self):
  24.         self.frame02 = tk.Frame(self, bg="orange")
  25.         self.frame02.pack(fill="both", expand=True)
  26.  
  27.     def create_frame03(self):
  28.         frame03 = tk.Frame(self.frame02, bg="grey", height=(2*self.settings.height//3), width=(3*self.settings.width//4))
  29.         frame03.pack(side="left", fill="y")
  30.  
  31.         line01 = tk.Frame(frame03, bg="white", height=(2*self.settings.height//9), width=(3*self.settings.width//4))
  32.         line01.pack(fill='x')
  33.  
  34.         button7 = tk.Button(line01, text="7", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  35.         button7.pack(fill="x", expand=True, side="left")
  36.    
  37.         button8 = tk.Button(line01, text="8", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  38.         button8.pack(fill="x", expand=True, side="left")
  39.  
  40.         button9 = tk.Button(line01, text="9", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  41.         button9.pack(fill="x", expand=True, side="left")
  42.  
  43.  
  44.         line02 = tk.Frame(frame03, bg="pink", height=(2*self.settings.height//9), width=(3*self.settings.width//4))
  45.         line02.pack(fill='x')
  46.        
  47.         button4 = tk.Button(line02, text="4", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  48.         button4.pack(fill="x", expand=True, side="left")
  49.  
  50.         button5 = tk.Button(line02, text="5", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  51.         button5.pack(fill="x", expand=True, side="left")
  52.  
  53.         button6 = tk.Button(line02, text="6", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  54.         button6.pack(fill="x", expand=True, side="left")
  55.  
  56.         line03 = tk.Frame(frame03, bg="white", height=(2*self.settings.height//9), width=(3*self.settings.width//4))
  57.         line03.pack(fill='x')
  58.  
  59.         button1 = tk.Button(line03, text="7", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  60.         button1.pack(fill="x", expand=True, side="left")
  61.  
  62.         button2 = tk.Button(line03, text="8", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  63.         button2.pack(fill="x", expand=True, side="left")
  64.  
  65.         button3 = tk.Button(line03, text="9", font=("Comic Sans Ms", int(sqrt(2)*self.settings.height//18), "bold"))
  66.         button3.pack(fill="x", expand=True, side="left")
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement