I think you misunderstood the examples. The first form using ^ is to toggle the flag.
The second form using &~ is to clear the flag. It sounds like you just want an explicit on and off. So that means for on you want this (using OR): self.windowFlags() | QtCore.Qt. WindowStaysOnTopHint And off using this (using AND NOT): self. windowFlags() & ~QtCore.Qt. WindowStaysOnTopHint The toggle example (XOR via ^) would be if it were just attached to a slot that didn't check anything and switched it back and forth. On Feb 6, 2013 3:38 AM, "san" <niceguy...@gmail.com> wrote: > > so today I got time to work on this part, > > def alwaysOnTop(self): > if self.alwaysOnTopAction.isChecked: > self.setWindowFlags(self.windowFlags() ^ QtCore.Qt.WindowStaysOnTopHint) > self.show() > else: > self.setWindowFlags(self.windowFlags() ^ QtCore.Qt.WindowStaysOnTopHint) > self.show() > self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint) # do i really need to add this line ? > > -- > 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_maya+unsubscr...@googlegroups.com. > To post to this group, send email to python_inside_maya@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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_maya+unsubscr...@googlegroups.com. To post to this group, send email to python_inside_maya@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.