Using Bootstrap or Fontawesome in PySide GUIs

185 views
Skip to first unread message

Mahmoodreza Aarabi

unread,
Feb 10, 2016, 4:46:36 AM2/10/16
to Python Programming for Autodesk Maya


Hello Developer
i want to know anybody used FontAwesome or Bootstrap in GUIs that created with PySide?

How is the workflow?
thanks

Roy Nieterau

unread,
Feb 10, 2016, 2:32:29 PM2/10/16
to Python Programming for Autodesk Maya
I'm using FontAwesome through QtAwesome and it's great. It's a package on Github and is just what I needed. I remember there being some extra dependencies to be both Py2 and Py3 compatible, but that was easy to remove (I only needed Py2).

It only depends on 'six' I think it was called. Nothing huge. Easy to use and supporting colors, different sizes, etc.

Mahmoodreza Aarabi

unread,
Feb 11, 2016, 3:16:00 AM2/11/16
to python_in...@googlegroups.com

Hey Roy
Thanks, it is good and i tested it and it worked.
but instead of importing PySide we should import qtpy, this will not cause problem later?


On Wed, Feb 10, 2016 at 11:02 PM, Roy Nieterau <royni...@gmail.com> wrote:
I'm using FontAwesome through QtAwesome and it's great. It's a package on Github and is just what I needed. I remember there being some extra dependencies to be both Py2 and Py3 compatible, but that was easy to remove (I only needed Py2).

It only depends on 'six' I think it was called. Nothing huge. Easy to use and supporting colors, different sizes, etc.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/aaa7d6b5-f0b8-464c-9f90-ceb7fd3638ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


Bests,
madoodia

Roy Nieterau

unread,
Feb 11, 2016, 2:29:06 PM2/11/16
to Python Programming for Autodesk Maya
I also removed that dependency and am just loading PySide. ;)

Mahmoodreza Aarabi

unread,
Feb 12, 2016, 1:06:18 AM2/12/16
to python_in...@googlegroups.com

hey man
thanks

i have this program as test:

#!/usr/bin/python
import sys
from PySide import QtCore, QtGui
# from qtpy import QtCore, QtGui
import qtawesome as qta

app = QtGui.QApplication(sys.argv)

fa_icon = qta.icon('fa.camera')
fa_button = QtGui.QPushButton(fa_icon, 'Camera')
fa_button.setIconSize(QtCore.QSize(32, 32))

fa_button.show()

sys.exit(app.exec_())

interesting thins is that it does not work on my system but in clean VM it works.
in bat file i set local packages, in local packages i have PySide and qtawesome

do you think i have some packages on my environment variables that conflict with local envs?

this is the error in my system:

Traceback (most recent call last):
  File "E:\Madoodia\_GitHub\_ANR\Pipeline\_bin\..\pyside_samples\pyside_awesome_
simple.py", line 12, in <module>
    fa_button = QtGui.QPushButton(fa_icon, 'Camera')
TypeError: 'PySide.QtGui.QPushButton' called with wrong argument types:
  PySide.QtGui.QPushButton(QIcon, str)
Supported signatures:
  PySide.QtGui.QPushButton(PySide.QtGui.QWidget = None)
  PySide.QtGui.QPushButton(PySide.QtGui.QIcon, unicode, PySide.QtGui.QWidget = N
one)
  PySide.QtGui.QPushButton(unicode, PySide.QtGui.QWidget = None)

On Thu, Feb 11, 2016 at 10:59 PM, Roy Nieterau <royni...@gmail.com> wrote:
I also removed that dependency and am just loading PySide. ;)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--


Bests,
madoodia

Roy Nieterau

unread,
Feb 12, 2016, 2:47:11 AM2/12/16
to Python Programming for Autodesk Maya
Did you change code in the QtAwesome package? Does it itself still have imports from qtpy or six?

Not sure what's happening on your system.

Roy Nieterau

unread,
Feb 12, 2016, 2:53:10 AM2/12/16
to Python Programming for Autodesk Maya
Or actually the error (I missed that in your post at first) says it's a signature error. That 'str' there should be unicode object. You can force it to unicode using

label = u"label text"

Where the 'u' explicitly states that it should be a unicode object.

Funnily enough I can't remember seeing this particular issue before, and it's interesting it works in one of the two systems:

- Does it have same Python version?
- Are you enforcing future imports in one rof the two? (from __future__ import something) Something like that.

Mahmoodreza Aarabi

unread,
Feb 12, 2016, 3:01:08 AM2/12/16
to python_in...@googlegroups.com
i added u'label', but does not work.
no not two version of code.
i have a py file and a bat file. when i run the bat file that call the py file, in my system it does not work. when i run the bat file (shared its folder) in clean VM it works

make sense?

i didn't change qtawesome code

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--


Bests,
madoodia

Mahmoodreza Aarabi

unread,
Feb 12, 2016, 3:04:39 AM2/12/16
to python_in...@googlegroups.com

fa_icon = qta.icon('fa.camera') returns QIcon?

--


Bests,
madoodia
Reply all
Reply to author
Forward
0 new messages