I have the following code snippet from a larger program which is working perfectly for making a gui and adding buttons to it: -
-
self.B0 = wx.Button(id=wxID_FRAME2B0, label='Choose Cases',
-
name='B0', parent=self, pos=wx.Point(300, 50),
-
size=wx.Size(400, 50),style=0)
-
self.B0.Bind(wx.EVT_BUTTON, self.OnB0Button, id=wxID_FRAME2B0)
I have no problems setting up the buttons but am now trying to add a larger font size and different font style to it. I have tried using these to no avail:
font=wx.Font(25 , wx.SWISS, wx.BOLD)
font=wx.SetFont (25, wx.SWISS, wx.BOLD)
The gui keeps crashing everytime i add one of these.
I have multiple buttons and would like one of them to have really big font but the others to have normal font.
Any help will be much appreciated.
7 6805 bvdet 2,851
Recognized Expert Moderator Specialist
What specific error message do you receive? To access a font that is accessible to the underlying system: - wx.Font(pointSize, family, style, weight)
Try providing a style argument.
Okay i added it to the code like so: - self.B1 = wx.Button(id=wxID_FRAME2B1, label='Ratings/RXB',
-
name='B1', parent=self, pos=wx.Point(100, 375),
-
size=wx.Size(90,25), style=0,
-
font=wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))
-
self.B1.Bind(wx.EVT_BUTTON, self.OnB1Button, id=wxID_FRAME2B1)
the error i am getting is
TypeError: 'font' is an invalid keyword argument for this function
I think i am referencing it incorrectly. Does it need to be declared within the wx.Button() parameters or is it supposed to be declared outside and then referenced within wx.Button() using some shorter code like font=(font1)?
bvdet 2,851
Recognized Expert Moderator Specialist
Try using the SetFont() button method. - self.B1.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))
ok i tried that but now i am getting this
AttributeError: 'Frame2' object has no attribute 'B1' - self.B1.SetFont(wx.Font(12, wx.SWITSS, wx.NORMAL, wx.NORMAL))
-
self.B1 = wx.Button(id=wxID_FRAME2B1, label='Ratings/RXB',
-
name='B1', parent=self, pos=wx.Point(100, 375), size=wx.Size(90,25), style=0)
-
self.B1.Bind(wx.EVT_BUTTON, self.OnB1Button, id=wxID_FRAME2B1)
is there something specific about placement of the code? does it have to go somewhere specific or can it go anywhere before the button definition like i have it ?
bvdet 2,851
Recognized Expert Moderator Specialist
You have to define self.B1 before you can use method self.B1.SetFont (). Think about it. How can you call a method of an object that does not exist?
-BV
AHHHHHHHHHHh i see. Thanks for your help. That was really stupid of me to not see that. Anyways I got it to work it needed to go after the button definition.
Thanks again. :)
bvdet 2,851
Recognized Expert Moderator Specialist
No problem. I am glad I could help. :)
-BV
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jacob Weber |
last post by:
Hello. Is it possible to specify the exact space between two lines,
measured from the baseline of the top line to the ascenders of the
second line?
I tried adding the space with padding-bottom, but it adds it below the
descenders. So the actual space between lines is larger than I specified.
Jacob
|
by: netclectic |
last post by:
I'm dynamically adding options to a select list in javascript and i
need to be able to set the height of the option, but setting
style.height has not effect, I also tried style.pixelHeight but no
joy.
i'm doing something like this (:
var selectControl = document.getElementById('MySelect');
var el = document.createElement('option');
el.value = "some value";
|
by: fleemo17 |
last post by:
My organization is developing a set of "standards" for websites built
inhouse. The first question that comes to mind is what would be a good
standard default size for <p> text? 12 point? Which begs the
question, what unit of measurement should we use for specifying font
sizes, points or ems?
Thanks.
-Fleemo
|
by: dixie |
last post by:
I want to be able to set the font size and font type for text in a text box
on a report using VBA. I wan't to be able to control it from a setting in a
table. The problem is that I don't know the syntax for setting either font
type or font size for a text box on a report. Does anyone know? Help.
Please!
dixie
|
by: Roger Withnell |
last post by:
How to I find out what size text the browser is set to?
Thanks in anticipation.
| |
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: Jason Carlton |
last post by:
Is there a way to change the font-family and font-size for each
individual option in a select menu? Something along the lines of:
<select size="1">
<option style="font-family: Arial; font-size: 8px">One</option>
<option style="font-family: Tahoma; font-size: 10px">Two</option>
<option style="font-family: Verdana; font-size: 12px">Three</option>
</select>
I see that I can change the color using style="color: whatever", but
|
by: Steve |
last post by:
I have a div with two - three paragrahs in it. Each paragraph has
its own inline style tag with its own font size setting. When I set
the last paragraph's font size the font sizes for ALL of the
paragraphs change.
Why?
How can I stop it?
I.E>
|
by: RGK |
last post by:
I'm doing an app with the AUI manager capabilities (using some of the
wxPython demo's for help). All is well, except I'm a bit disappointed
with the font management.
The default font for all the widgets (TextCtrl's, StaticText's etc) are
a bit large for my design intent and as I try to adjust that, it appears
I have to do a
font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
font.SetPointSize(9)
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |