fireHDで家計簿作成③ fireHDでTkinter
アンドロイドVNCをいれました。
無料なのにタッチ操作が割りと快適だからです。
暫定の画面
以下ソースコード
termuxで実行してアンドロイドVNCで覗く。
import tkinter as tk from tkinter import ttk from tkinter import messagebox import sys class Sizeset(): """ fo = {'font' : 'times new roman', 'size' : 18, 'tickness' : 'bold'},\ wt = 200, hg = 100,\ fc = 'green',\#FontColor fg = 'green',\#ActiveFontColor unimplemented bg = 'black',\#not ActiveBackColor ag = 'blue',\#ActiveBackColor ac = 'w', 'nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se', 'center' jf = tk.CENTER ,tk.LEFT, tk.RIGHT rf = relief:'flat', 'raised', 'sunken', 'groove', 'ridge', 'solid' """ def __init__(\ self,\ fo = {'font' : 'times new roman', 'size' : 18, 'tickness' : 'bold'},\ wt = 200, hg = 100,\ fc = 'green',\ fg = 'green',\ bg = 'black',\ ag = 'blue',\ ac = 'center',\ jf = tk.CENTER,\ rf = 'sunken'\ ): self.__FontOption = fo self.__Width = wt self.__Height = hg self.__FontColor = fc self.__ActiveFontColor = fg self.__BackGround = bg self.__ActiveBackGround = ag self.__Anchor = ac self.__Justify = jf self.__Relief = rf def fontoption(self): return self.__FontOption def width(self): return self.__Width def height(self): return self.__Height def fontcolor(self): return self.__FontColor def activefontcolor(self): return self.__ActiveFontColor def frontcolor(self): return self.__BackGround def backcolor(self): return self.__ActiveBackGround def anchor(self): return self.__Anchor def justify(self): return self.__Justify def relief(self): return self.__Relief class OyaFrame(tk.Frame): def __init__(self, master = None): super().__init__(master) """ fc = 'black',\#FontColor fg = 'black',\#ActiveFontColor bg = 'green',\#not ActiveBackColor ag = 'blue',\#ActiveBackColor ac = 'w',\#Anchor jf = tk.CENTER,\#Justify rf = 'SUNKEN'#relief """ self.monitor_height = self.master.winfo_screenheight() self.monitor_width = self.master.winfo_screenwidth() self.master.geometry(str(self.monitor_width)+'x'+str(self.monitor_height-50)) BS = Sizeset(fo = {'font' : 'times new roman', 'size' : 48, 'tickness' : 'normal'},\ wt = self.monitor_width / 3, hg = self.monitor_height / 6 ,\ fc = 'black',\ fg = 'black',\ bg = 'green2',\ ag = 'green3',\ ac = 'center',\ jf = tk.CENTER,\ rf = 'sunken'\ ) #style = ttk.Style() #style.configure('office.TButton', font=20, anchor='w') #print(self.monitor_height,self.monitor_width) #self.master.geometry('1920x1080') # ボタンの作成 Button_Text = ['登録', '修正', '解析', '終了'] Button_Command = {0:self.Button0, 1:self.Button1, 2:self.Button2, 3:self.Button3} self.button = [] for n in range(len(Button_Text)): self.button.append(tk.Button(self.master,\ text = Button_Text[n],\ fg = BS.fontcolor(),\ activeforeground = BS.activefontcolor(),\ bg = BS.frontcolor(),\ activebackground = BS.backcolor(),\ font=(BS.fontoption()['font'], BS.fontoption()['size'], BS.fontoption()['tickness']),\ anchor = BS.anchor(),\ justify = BS.justify(),\ relief = BS.relief(),\ command = Button_Command[n] )) self.button[n].place(x = self.monitor_width/10,\ y = self.monitor_height / 8 + (BS.height() * 1.1) * n ,\ width = BS.width(), height =BS.height()) print(len(self.button)) #Button Comand def Button0(self): #resistor messagebox.showinfo('event', 'Button0 was Pushed!') print('Button0 was Pushed!') def Button1(self): #revise messagebox.showinfo('event', 'Button1 was Pushed!') print('Button1 was Pushed!') def Button2(self): #analysis messagebox.showinfo('event', 'Button2 was Pushed!') print('Button2 was Pushed!') def Button3(self): #close messagebox.showinfo('event', 'Button3 was Pushed!') self.master.destroy() sys.exit() def main(): root = tk.Tk() app = OyaFrame(master = root) app.mainloop() if __name__ == "__main__": main()
キャッシュ溜まったら
pip cache purge