Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit 6d8fc22

Browse files
committed
Splash formatting
1 parent fcf8d75 commit 6d8fc22

File tree

6 files changed

+50
-51
lines changed

6 files changed

+50
-51
lines changed

res/docs/intro.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Welcome to the "Always one-hundred percent correct, never wrong in any way, completely correct"
2-
personality quiz. Through this quiz you will achieve new levels of spiritual insight, of not only
3-
yourself, but the very fabric of reality.
1+
Note:
42

5-
However, first I'd like to get to know you a little. Please answer these very important questions
6-
with the utmost honesty, they are crucial to achieving enlightenment.
3+
Through this quiz you will achieve new levels of spiritual insight, of not only yourself, but the very fabric of reality.
4+
5+
Please answer these very important questions with the utmost honesty, they are crucial to achieving true enlightenment.

res/settings.ini

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
[DEFAULT]
2-
main.title = App
3-
main.geometry = 400x500
4-
main.background = black
5-
cachesize = 10
6-
catapi = https://api.thecatapi.com/v1/images/search
7-
namefile = https://www.pawclub.com.au/assets/js/namesTemp.json
8-
hobbiesfile = https://gist.githubusercontent.com/mbejda/453fdb77ef8d4d3b3a67/raw/e8334f09109dc212892406e25fdee03efdc23f56/hobbies.txt
9-
like.text = Like
10-
like.background = red
11-
dislike.text = Dislike
12-
dislike.background = red
13-
back.text = Back to Photo
14-
back.background = blue
15-
bio.text = Bio
16-
bio.background = blue
17-
18-
191
[APP]
20-
title = App
2+
title = The Always (One-Hundred Percent of the Time) Correct and Never Wrong (In Any Way), Completely Accurate Personality Quiz Adventure
3+
geometry = 400x500

src/animate.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def add(self, motion: Motion):
154154
self._motions.add(iter(motion))
155155

156156
def add_motion(self, id: int, end: Coord, **kwargs):
157-
motion = Motion(self.canvas, id, (end,), **kwargs)
157+
motion = Motion(self.canvas, id, end, **kwargs)
158158
self.add(motion)
159159

160160
def clear(self):
@@ -172,31 +172,32 @@ class Motion:
172172
"""
173173
canvas: tk.Canvas
174174
id: int
175-
endpoints: Tuple[Coord]
175+
end: Coord
176176

177177
speed: int = 1
178178

179179
def start(self) -> Generator[Callable]:
180180
"""
181181
The entry point for generating move commands.
182182
"""
183-
move = partial(self.canvas.move, self.id)
184-
185183
def frame(increment: Coord, count: int = 1):
186184
for _ in range(count):
187185
move(*increment)
188186
self.canvas.master.update_idletasks()
189187

190-
for end in self.endpoints:
191-
start = self.current
192-
steps = round(start.distance(end) / self.speed)
193-
frames = round(steps / self.speed)
194-
increment = (end - start) / steps
188+
start = self.current
189+
steps = round(start.distance(self.end) / self.speed)
190+
frames = round(steps / self.speed)
191+
increment = (self.end - start) / steps
192+
193+
for _ in range(frames):
194+
yield partial(frame, increment, round(steps / frames))
195+
buffer = self.end - self.current
196+
yield partial(frame, buffer)
195197

196-
for _ in range(frames):
197-
yield partial(frame, increment, round(steps / frames))
198-
buffer = end - self.current
199-
yield partial(frame, buffer)
198+
@property
199+
def move(self):
200+
return partial(self.canvas.move, self.id)
200201

201202
@property
202203
def current(self):
@@ -213,3 +214,7 @@ def __hash__(self):
213214

214215
def __eq__(self):
215216
return isinstance(self, type(other)) and self.__key() == other.__key()
217+
218+
219+
class BounceBall(Motion):
220+

src/main.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from .front import Front
66
from .splash import Splash
7-
from . import SETTINGS
7+
from . import SETTINGS, widget
88

99

1010
parser = configparser.ConfigParser()
@@ -15,17 +15,18 @@ class App(tk.Tk):
1515
appconfig = parser['APP']
1616

1717
def __init__(self, *args, **kwds):
18-
title = self.appconfig.pop('title')
1918
super().__init__(*args, **kwds)
20-
self.title = title
19+
self.resizable(False, False)
2120

22-
self.geometry = '400x500'
23-
self.minsize(400, 500)
24-
self.maxsize(400, 500)
21+
for name, val in parser['APP'].items():
22+
getattr(self, name)(val)
2523

26-
# self.splash = Splash(self)
24+
self.frame = widget.PrimaryFrame(self)
25+
self.frame.pack(expand=True, fill='both')
26+
27+
# self.splash = Splash(self.frame)
2728
# self.splash.pack(expand=True, fill='both')
28-
self.front = Front(self)
29+
self.front = Front(self.frame)
2930
self.front.pack(fill='both', expand=True)
3031

3132
def cleanup(self):

src/splash.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,30 @@ def load(self, choices):
2929

3030
class Splash(widget.PrimaryFrame):
3131

32-
intro = (DOCS / 'intro.txt').read_text() # .replace('\n', ' ').split(' ')
32+
intro = (DOCS / 'intro.txt').read_text()
3333
with (DOCS / 'questions.json').open() as fp:
3434
questions = json.load(fp)
3535

3636
def init(self):
37-
self.window = Window(self)
38-
self.window.pack(expand=True, fill='both')
37+
self.title = widget.PrimaryLabel(
38+
self, text=self.master.master.title(),
39+
font=('Courier', 14), wraplength=300
40+
)
3941

42+
self.window = Window(self, bg='gray')
4043
self.intro = View(
4144
self.window,
4245
text=self.intro,
4346
width=self.window.winfo_reqwidth(),
44-
font=('sys', 14),
45-
fill='white'
47+
font=('sys', 10), justify='center'
4648
)
4749
self.window.set_view(self.intro)
50+
51+
self.btn_confirm = widget.PrimaryButton(self, command=self.begin, text='Okay')
52+
53+
self.title.pack(fill='x', pady=20)
54+
self.btn_confirm.pack(side='bottom', expand=True)
55+
56+
57+
def begin(self):
58+
pass

src/widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class PrimaryLabel(tk.Label):
7878
DEFAULT = {
7979
'font': ('Courier', 25),
8080
'bg': 'black',
81-
'fg': 'blue'
81+
'fg': 'gray'
8282
}
8383

8484
def __init__(self, *args, **kwds):

0 commit comments

Comments
 (0)