diff --git a/build/lib/pygwin/font.py b/build/lib/pygwin/font.py index 4532537..615ae8a 100644 --- a/build/lib/pygwin/font.py +++ b/build/lib/pygwin/font.py @@ -30,7 +30,7 @@ class font: surface._surface_orig = surf return surface def size(self, text, size, newLineSpace=5, - italic=False, bold=False, underline=False): + italic=False,bold=False,underline=False): return self.render(text, size, (255,255,255), newLineSpace=newLineSpace, italic=italic, bold=bold, diff --git a/build/lib/pygwin/ui.py b/build/lib/pygwin/ui.py index 70f4ddf..10a7891 100644 --- a/build/lib/pygwin/ui.py +++ b/build/lib/pygwin/ui.py @@ -212,11 +212,12 @@ class entry(widget): if _ct.WinDLL("User32.dll").GetKeyState(0x14): text = text.upper() if _pg.key.get_pressed()[_pg.K_LSHIFT] or _pg.key.get_pressed()[_pg.K_RSHIFT]: - text = text.translate(dict(zip(map(ord, '''1234567890-=[]\\;'''+"',./`"), - '''!@#$%^&*()_+{}|:"<>?~'''))) + text = text.translate(dict(zip(map(ord, + '''1234567890-=[]\\;'''+"',./`"),'''!@#$%^&*()_+{}|:"<>?~'''))) if hex(getattr(_ct.windll.LoadLibrary("user32.dll"), "GetKeyboardLayout")(0))=='0x4190419': - text = text.translate(dict(zip(map(ord, '''qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?~'''), - '''йцукенгшщзхъфывапролджэячсмитьбю.ёЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,Ё'''))) + text = text.translate(dict(zip(map(ord, + '''qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?~'''), + '''йцукенгшщзхъфывапролджэячсмитьбю.ёЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,Ё'''))) if text in self.blacklist: return if self.whitelist != None: @@ -304,8 +305,10 @@ class textarea(widget): self.tick += 1 if self.tick >= 60: if self.text != '': - points = [[x+self.font.size(last,self.fontSize)[0],self.surface.size[1]-(self.font.size('X',self.fontSize)[1])], - [x+self.font.size(last,self.fontSize)[0],self.surface.size[1]/2-text.size[1]/2+self.surface.size[1]-10]] + points = [[x+self.font.size(last,self.fontSize)[0], + self.surface.size[1]-(self.font.size('X',self.fontSize)[1])], + [x+self.font.size(last,self.fontSize)[0], + self.surface.size[1]/2-text.size[1]/2+self.surface.size[1]-10]] self.surface.draw.line(self.lineColor,points[0],points[1],3) if self.tick == 120: self.tick = 0 @@ -355,9 +358,11 @@ class textarea(widget): if _pg.key.get_pressed()[_pg.K_LSHIFT] or _pg.key.get_pressed()[_pg.K_RSHIFT]: text = text.translate(dict(zip(map(ord, '''1234567890-=[]\\;'''+"',./`"), '''!@#$%^&*()_+{}|:"<>?~'''))) - if hex(getattr(_ct.windll.LoadLibrary("user32.dll"), "GetKeyboardLayout")(0))=='0x4190419': - text = text.translate(dict(zip(map(ord, '''qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?~'''), - '''йцукенгшщзхъфывапролджэячсмитьбю.ёЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,Ё'''))) + if hex(getattr(_ct.windll.LoadLibrary("user32.dll"), + "GetKeyboardLayout")(0))=='0x4190419': + text = text.translate(dict(zip(map(ord, + '''qwertyuiop[]asdfghjkl;'zxcvbnm,./`QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?~'''), + '''йцукенгшщзхъфывапролджэячсмитьбю.ёЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,Ё'''))) if text in self.blacklist: return if self.whitelist != None: @@ -612,15 +617,19 @@ class checkBox(widget): self.surface.size[0]-self.borderWidth*2, self.surface.size[1]-self.borderWidth*2)) if self.x: - self.surface.draw.line(self.afg,[self.borderWidth,self.width/2+self.borderWidth],[self.width/2,self.width-self.borderWidth],self.borderWidth) - self.surface.draw.line(self.afg,[self.width/2,self.width-self.borderWidth],[self.width-self.borderWidth,self.borderWidth],self.borderWidth) + self.surface.draw.line(self.afg,[self.borderWidth,self.width/2+self.borderWidth], + [self.width/2,self.width-self.borderWidth],self.borderWidth) + self.surface.draw.line(self.afg,[self.width/2,self.width-self.borderWidth], + [self.width-self.borderWidth,self.borderWidth],self.borderWidth) else: self.surface.draw.rect(self.bg,_r(self.borderWidth,self.borderWidth, self.surface.size[0]-self.borderWidth*2, self.surface.size[1]-self.borderWidth*2)) if self.x: - self.surface.draw.line(self.fg,[self.borderWidth,self.width/2+self.borderWidth],[self.width/2,self.width-self.borderWidth],self.borderWidth) - self.surface.draw.line(self.fg,[self.width/2,self.width-self.borderWidth],[self.width-self.borderWidth,self.borderWidth],self.borderWidth) + self.surface.draw.line(self.fg,[self.borderWidth,self.width/2+self.borderWidth], + [self.width/2,self.width-self.borderWidth],self.borderWidth) + self.surface.draw.line(self.fg,[self.width/2,self.width-self.borderWidth], + [self.width-self.borderWidth,self.borderWidth],self.borderWidth) def draw(self, win, pos): self._generate(pos) win.blit(self.surface,pos) @@ -633,6 +642,51 @@ class checkBox(widget): # def draw(self, win, pos): # self._generate(pos) # win.blit(self.surface,pos) +class tip(widget): + def __init__(self,text,responceWidth,responceHeight,fontSize=15,font=_df, + borderColor=(180,180,50),borderWidth=2,bg=(255,255,128), + fg=(35,35,5),waitBeforeShowing=0, + tipPosRelativeCursor=(10,10)): + super()._args(locals()) + self.tick = -1 + self.lcp = (0,0) + self.tprc = self.tipPosRelativeCursor + self._generate() + def _generate(self, position=None): + self.surface = _s((self.responceWidth, + self.responceHeight)) + if position != None: + self.tick += 1 + if self.lcp != _m.getPosition(): + self.tick = 0 + self.lcp = _m.getPosition() + if self.tick >= self.waitBeforeShowing: + mp = _m.getPosition() + mp = [mp[0]+self.tprc[0]-position[0], + mp[1]+self.tprc[1]-position[1]] + rect = _r(mp[0],mp[1], + self.font.size(self.text,self.fontSize)[0]+4, + self.font.size(self.text,self.fontSize)[1]+6) + if mp[0]<0 or mp[1]<0:return + if mp[0]>self.responceWidth:return + if mp[1]>self.responceHeight:return + if mp[0]>self.responceWidth-rect.w: + mp[0]=self.responceWidth-rect.w + if mp[1]>self.responceHeight-rect.h: + mp[1]=self.responceHeight-rect.h + rect = _r(mp[0],mp[1], + self.font.size(self.text,self.fontSize)[0]+4, + self.font.size(self.text,self.fontSize)[1]+6) + self.surface.draw.rect(self.bg,rect) + self.surface.draw.rect( + self.borderColor,rect,self.borderWidth) + ts = self.font.render( + self.text,self.fontSize,self.fg) + self.surface.blit(ts,(mp[0]+2,mp[1]+3)) + def draw(self, win, pos): + self._generate(pos) + win.blit(self.surface,pos) + class base: def __init__(self, win, bg=(128,128,128)): self._widgets = {} diff --git a/dist/pgw-0.0.1-py3-none-any.whl b/dist/pgw-0.0.1-py3-none-any.whl new file mode 100644 index 0000000..27b66a2 Binary files /dev/null and b/dist/pgw-0.0.1-py3-none-any.whl differ diff --git a/dist/pgw-0.0.1.tar.gz b/dist/pgw-0.0.1.tar.gz new file mode 100644 index 0000000..5b8f64f Binary files /dev/null and b/dist/pgw-0.0.1.tar.gz differ diff --git a/pgw.egg-info/PKG-INFO b/pgw.egg-info/PKG-INFO new file mode 100644 index 0000000..52d2adf --- /dev/null +++ b/pgw.egg-info/PKG-INFO @@ -0,0 +1,12 @@ +Metadata-Version: 2.1 +Name: pgw +Version: 0.0.1 +Summary: A library for creating Python applications. +Home-page: UNKNOWN +Author: themixray +License: MIT +Platform: UNKNOWN +License-File: LICENSE + +UNKNOWN + diff --git a/pgw.egg-info/dependency_links.txt b/pgw.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pgw.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/pgw.egg-info/requires.txt b/pgw.egg-info/requires.txt new file mode 100644 index 0000000..569ce2e --- /dev/null +++ b/pgw.egg-info/requires.txt @@ -0,0 +1,7 @@ +cython +pywin32 +pygame +inputs +pydub +wxPython +pyautogui diff --git a/setup.bat b/setup.bat index 348434a..d101598 100644 --- a/setup.bat +++ b/setup.bat @@ -1,3 +1,2 @@ @echo off python setup.py install -pause diff --git a/setup.cfg b/setup.cfg index b14fcd9..7d6a823 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,9 @@ [metadata] -name = pygwin0 +name = pgw version = 0.0.1 author = themixray author_email = simindeymo@gmail.com -description = A library for creating Python applications. +description = Python Grapchical Window. long_description = file: README.md long_description_content_type = text/markdown url = https://github.com/themixray/pygwin diff --git a/setup.py b/setup.py index 322bf90..b68e424 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from setuptools import setup -setup(name='pygwin',packages=['pygwin'],version='0.0.1',author='themixray', - description='A library for creating Python applications.',license='MIT', - install_requires=['cython','pywin32','pygame','inputs','pydub','wxPython']) +setup(name='pgw',packages=['pygwin'],version='0.0.1',author='themixray', + description='A library for creating Python applications.', + license='MIT',install_requires=['cython','pywin32','pygame', + 'inputs','pydub','wxPython','pyautogui'])