- Jul 18, 2018
- 90
- 149
Hi all,
I've got a dirt simple money gui up and running, but I want to make two changes: (i) I want the frame I use to have a little padding on the right side so that there's a space between the last zero and the edge of the frame, and (ii) I want the figure to display commas, so that $1000000 will display as $1,000,000.
Fashion Business does it really well, using code that looks like this: $ money_text = "$ " + '{:10,.2f}'.format(money), but there's a surprising amount going on there, and I can't figure out how to import what it's doing into my existing code.
Anybody know the answers? Thanks in advance! My current code below, and how it looks on the screen attached as a screenshot.
***
style frame_gui1:
background Frame("images/gui/Frame1.png", 25, 25, 25, 25)
screen moneyhud:
frame:
style "frame_gui1"
has hbox xalign 0.0 yalign 0.0
add "images/money_dollar.png"
text "{font=images/gui/Franklin Gothic Demi Regular.ttf}{color=#e80000}$[money]{/color}{/font}" yoffset 15
I've got a dirt simple money gui up and running, but I want to make two changes: (i) I want the frame I use to have a little padding on the right side so that there's a space between the last zero and the edge of the frame, and (ii) I want the figure to display commas, so that $1000000 will display as $1,000,000.
Fashion Business does it really well, using code that looks like this: $ money_text = "$ " + '{:10,.2f}'.format(money), but there's a surprising amount going on there, and I can't figure out how to import what it's doing into my existing code.
Anybody know the answers? Thanks in advance! My current code below, and how it looks on the screen attached as a screenshot.
***
style frame_gui1:
background Frame("images/gui/Frame1.png", 25, 25, 25, 25)
screen moneyhud:
frame:
style "frame_gui1"
has hbox xalign 0.0 yalign 0.0
add "images/money_dollar.png"
text "{font=images/gui/Franklin Gothic Demi Regular.ttf}{color=#e80000}$[money]{/color}{/font}" yoffset 15