fixing bugs

This commit is contained in:
danamir
2018-12-12 09:46:16 +03:00
parent 7b9ef410c1
commit ca1f945101
2 changed files with 25 additions and 13 deletions

View File

@@ -2,12 +2,19 @@ import os
import tkinter as tk
import wx
def hex_to_rgb(value):
value = value.lstrip('#')
lv = len(value)
return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
def setBacgroundColor():
"""
Устанавливает цвет панели для приложения
:return:
"""
color = "white"
hex_color = "#DBF0B2"
color =hex_to_rgb(hex_color)
return color
def setBckgroundButtonColor():
@@ -16,8 +23,9 @@ def setBckgroundButtonColor():
Устанавливает цвет кнопок
:return:
"""
wx.lib.colourdb.updateColourDB()
color = wx.NamedColour("light coral")
hex_color = "#F8B8B8"
color = hex_to_rgb(hex_color)
return color
def getFullPath(file):
@@ -26,7 +34,7 @@ def getFullPath(file):
return path
def setSize():
def setFrameSize():
"""
:parameter sh,sw - ширина и высота экрана, на котором
запускается программа
@@ -35,9 +43,9 @@ def setSize():
root = tk.Tk()
sw = root.winfo_screenwidth()
sh = root.winfo_screenheight()
w = int(0.75 * sw)
h = int(0.75 * sh)
w,h = int(0.75 * sw), int(0.75 * sh)
if w < 800 and h < 600:
w, h = 800, 600
return w, h

14
main.py
View File

@@ -12,7 +12,7 @@ class MyFrame(wx.Frame):
# begin wxGlade: MyFrame.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.panel_1 = wx.Panel(self, wx.ID_ANY)
self.panel_1 = wx.Panel(self, wx.ID_ANY, size=(100, 100))
self.inpt_name = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.inpt_familia = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.inpt_group = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
@@ -20,6 +20,7 @@ class MyFrame(wx.Frame):
self.btn2 = wx.Button(self.panel_1, wx.ID_ANY, u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438")
self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, u"\u0414\u0430\u043b\u0435\u0435")
self.__set_properties()
self.__do_layout()
# end wxGlade
@@ -30,15 +31,18 @@ class MyFrame(wx.Frame):
self.inpt_name.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.inpt_familia.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.inpt_zachetka.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
self.framesize = controller.setFrameSize()
print(self.framesize)
self.btn2.SetMinSize((100, 50))
self.button_1.SetMinSize((100, 50))
self.frameSize = controller.setSize()
self.SetSize(self.frameSize)
self.SetMinSize((800, 600))
self.color = controller.setBacgroundColor()
self.panel_1.SetBackgroundColour(self.color)
# end wxGlade
self.button_1.SetBackgroundColour(controller.setBckgroundButtonColor())
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout