--0-1112063886-1308666223=:18781
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
I tried both of the methods below:
I get the following error:
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\PythonCard\widget.py", line 408, in _dispatch
handler(background, aWxEvent)
File "C:\Users\wsande\Documents\Warren\PythonScripts\PC_slider_text\pc_slider_text.py", line 11, in on_Slider1_mouseUp
font.SetPointSize(sliderValue)
AttributeError: 'Font' object has no attribute 'SetPointSize'
Here's the complete code:
# pc_slider_text.py
# try to change the size of text font in a test box using a slider
from wx import *
from PythonCard import model
class MainWindow(model.Background):
def on_Slider1_mouseUp(self, event):
sliderValue = self.components.Slider1.value
print sliderValue
font = self.components.TextArea1.font
font.SetPointSize(sliderValue)
self.components.TextArea1.SetFont(font)
print self.components.TextArea1.font
app = model.Application(MainWindow)
app.MainLoop()
Post by Wagner, John________________________________
Sent: Monday, June 20, 2011 10:37 PM
Subject: Re: [Pythoncard-users] Dynamically change font size of a TextArea
A slightly cleaner way
font = self.components.TextArea1.GetFont()
font.SetPointSize(16)
self.components.TextArea1.SetFont(font)
Cheers,
Lawrie
Post by unknownHi,
self.components.TextArea1.font_size = sliderValue
doesnt work for me
print self.components.TextArea1.font.size
gives a dictionary of font attributes, but I can't get them to update either
import wx
font_size =16
font1 = self.components.TextArea1.GetFont()
font2 = wx.Font(font_size, font1.Family, font1.Style, font1.Weight)
self.components.TextArea1.SetFont( font2 )
seems to work
HTH,
Lawrie
Post by unknownself.components.TextArea1.font_size = sliderValue
It doesn't throw an exception, but it doesn't change the font size, either.
Also, oddly, the slider never seems to lose focus. It keeps sliding back
and forth even after the mouse is released and no longer over the slider. I
can't get focus on the TextArea.
- hwg
________________________________
Sent: Saturday, June 18, 2011 11:45 PM
Subject: Re: [Pythoncard-users] Dynamically change font size of a TextArea
font is not a dictionary. It's a class. Try font._size
from PythonCard import model
sliderValue = self.components.Slider1.value
self.components.TextArea1.font['size'] = sliderValue
app = model.Application(MainWindow)
app.MainLoop()
--
Kim Cheung
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Pythoncard-users mailing list
https://lists.sourceforge.net/lists/listinfo/pythoncard-users
--0-1112063886-1308666223=:18781
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div>I tried both of the methods below:</div><div><br></div><div>I get the following error:</div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><br></div><div><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">Traceback (most recent call last):</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> File "C:\Python25\lib\site-packages\PythonCard\widget.py", line 408, in _dispatch</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">handler(background, aWxEvent)</span><br style="font-family:Courier New, courier, monaco, monospace,
sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> File "C:\Users\wsande\Documents\Warren\PythonScripts\PC_slider_text\pc_slider_text.py", line 11, in on_Slider1_mouseUp</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">font.SetPointSize(sliderValue)</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">AttributeError: 'Font' object has no attribute 'SetPointSize'</span><br></div><div><br></div><div>Here's the complete code:</div><div><br></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;"># <a target="_blank" href="http://pc_slider_text.py/"><span class="yshortcuts" id="lw_1308666021_0">pc_slider_text.py</span></a><br># try to change the size of text font in
a test box using a slider<br><br></div><div><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">from wx import *</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">from PythonCard import model</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">class MainWindow(model.Background):</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> def on_Slider1_mouseUp(self, event):</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> sliderValue =
self.components.Slider1.value</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> print sliderValue</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> font = self.components.TextArea1.font</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> font.SetPointSize(sliderValue)</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"> self.components.TextArea1.SetFont(font)</span><br
style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">
print self.components.TextArea1.font</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"></span></div><div><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><br></span></div><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">a</span><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">pp = model.Application(MainWindow)</span><br style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span style="font-family:Courier New, courier, monaco, monospace, sans-serif;">app.MainLoop()</span><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new
york, times, serif; font-size: 12pt;"><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Lawrence Abbott <***@gmail.com><br><b><span style="font-weight: bold;">To:</span></b> hwg <***@yahoo.com><br><b><span style="font-weight: bold;">Sent:</span></b> Monday, June 20, 2011 10:37 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Pythoncard-users] Dynamically change font size of a TextArea<br></font><br>
A slightly cleaner way<br><br> font = self.components.TextArea1.GetFont()<br> font.SetPointSize(16)<br> self.components.TextArea1.SetFont(font)<br><br>Cheers,<br>Lawrie<br><br>On Tue, Jun 21, 2011 at 12:26 PM, Lawrence Abbott <<a ymailto="mailto:***@gmail.com" href="mailto:***@gmail.com">***@gmail.com</a>> wrote:<br>> Hi,<br>><br>> self.components.TextArea1.font_size = sliderValue<br>><br>> doesnt work for me<br>><br>> print self.components.TextArea1.font.size<br>><br>> gives a dictionary of font attributes, but I can't get them to update either<br>><br>> import wx<br>><br>> font_size =16<br>><br>> font1 = self.components.TextArea1.GetFont()<br>> font2 = wx.Font(font_size, font1.Family, font1.Style, font1.Weight)<br>> self.components.TextArea1.SetFont( font2 )<br>><br>> seems to work<br>><br>>
HTH,<br>> Lawrie<br>><br>> On Mon, Jun 20, 2011 at 2:27 AM, hwg <<a ymailto="mailto:***@yahoo.com" href="mailto:***@yahoo.com">***@yahoo.com</a>> wrote:<br>>> I tried:<br>>><br>>> self.components.TextArea1.font_size = sliderValue<br>>> It doesn't throw an exception, but it doesn't change the font size, either.<br>>> Also, oddly, the slider never seems to lose focus. It keeps sliding back<br>>> and forth even after the mouse is released and no longer over the slider. I<br>>> can't get focus on the TextArea.<br>>><br>>><br>>> - hwg<br>>><br>>><br>>> ________________________________<br>>> From: "<a ymailto="mailto:***@gmail.com" href="mailto:***@gmail.com">***@gmail.com</a>" <<a ymailto="mailto:***@gmail.com" href="mailto:***@gmail.com">***@gmail.com</a>><br>>> To: hwg <<a
ymailto="mailto:***@yahoo.com" href="mailto:***@yahoo.com">***@yahoo.com</a>><br>>> Cc: "<a ymailto="mailto:pythoncard-***@lists.sourceforge.net" href="mailto:pythoncard-***@lists.sourceforge.net">pythoncard-***@lists.sourceforge.net</a>"<br>>> <<a ymailto="mailto:pythoncard-***@lists.sourceforge.net" href="mailto:pythoncard-***@lists.sourceforge.net">pythoncard-***@lists.sourceforge.net</a>><br>>> Sent: Saturday, June 18, 2011 11:45 PM<br>>> Subject: Re: [Pythoncard-users] Dynamically change font size of a TextArea<br>>><br>>> font is not a dictionary. It's a class. Try font._size<br>>><br>>> On 6/17/2011 1:23 PM, hwg wrote:<br>>><br>>> from PythonCard import model<br>>> class MainWindow(model.Background):<br>>> def on_Slider1_mouseUp(self, event):<br>>> sliderValue =
self.components.Slider1.value<br>>> self.components.TextArea1.font['size'] = sliderValue<br>>><br>>> app = model.Application(MainWindow)<br>>> app.MainLoop()<br>>><br>>> --<br>>> Kim Cheung<br>>><br>>><br>>> ------------------------------------------------------------------------------<br>>> EditLive Enterprise is the world's most technically advanced content<br>>> authoring tool. Experience the power of Track Changes, Inline Image<br>>> Editing and ensure content is compliant with Accessibility Checking.<br>>> http://p.sf.net/sfu/ephox-dev2dev<br>>> _______________________________________________<br>>> Pythoncard-users mailing list<br>>> <a ymailto="mailto:Pythoncard-***@lists.sourceforge.net" href="mailto:Pythoncard-***@lists.sourceforge.net">Pythoncard-***@lists.sourceforge.net</a><br>>> <a
href="https://lists.sourceforge.net/lists/listinfo/pythoncard-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/pythoncard-users</a><br>>><br>>><br>><br><br><br></div></div></blockquote></div></div></body></html>
--0-1112063886-1308666223=:18781--