PyQT5 QTabbar Expand tab header - python

I am writing a QTabwidget with only two tabs. But the tab headers (name) are not fitting the QTabwidget width. I want to fit the length of the tab bar (two tab headers)
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QAction, QTabWidget,QVBoxLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class App(QMainWindow):
def __init__(self):
super().__init__()
self.table_widget = MyTableWidget(self)
self.setCentralWidget(self.table_widget)
self.show()
class MyTableWidget(QWidget):
def __init__(self, parent):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
self.tabs = QTabWidget()
""" Here I want to fit the two tab
headers withthe QTabwidget width
"""
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tabs.resize(300,200)
self.tabs.addTab(self.tab1,"Tab 1")
self.tabs.addTab(self.tab2,"Tab 2")
# Create first tab
self.tab1.layout = QVBoxLayout(self)
self.layout.addWidget(self.tabs)
self.setLayout(self.layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())

The size of tabs is computed using the hints given by the current QStyle.
Since QTabWidget uses the sizeHint of the tab bar to set the tab bar size and the sizeHint is usually based on the tabSizeHint(), you have to reimplement both:
sizeHint() is required in order to provide a width (or height) that is the same as the parent;
tabSizeHint() takes into account the base implementation of sizeHint() to compute the hint based on the contents of the tabs, and if it's less than the current size it suggests a size based on the available space divided by the tab count;
class TabBar(QtWidgets.QTabBar):
def sizeHint(self):
hint = super().sizeHint()
if self.isVisible() and self.parent():
if not self.shape() & self.RoundedEast:
# horizontal
hint.setWidth(self.parent().width())
else:
# vertical
hint.setHeight(self.parent().height())
return hint
def tabSizeHint(self, index):
hint = super().tabSizeHint(index)
if not self.shape() & self.RoundedEast:
averageSize = self.width() / self.count()
if super().sizeHint().width() < self.width() and hint.width() < averageSize:
hint.setWidth(averageSize)
else:
averageSize = self.height() / self.count()
if super().sizeHint().height() < self.height() and hint.height() < averageSize:
hint.setHeight(averageSize)
return hint
# ...
self.tabWidget = QtWidgets.QTabWidget()
self.tabWidget.setTabBar(TabBar(self.tabWidget))
Do note that this is a very basic implementation, there are some situations for which you might see the scroll buttons with very long tab names, even if theoretically there should be enough space to see them.

Inspired by this answer, I think you can override showEvent (and even resizeEvent) to calculate the new width and set it through stylesheets.
It is not canonical but it does the job.
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QTabWidget, QVBoxLayout
class App(QMainWindow):
def __init__(self):
super().__init__()
self.table_widget = MyTableWidget(self)
self.setCentralWidget(self.table_widget)
self.show()
class MyTableWidget(QWidget):
def __init__(self, parent):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
self.tabs = QTabWidget()
self.tabs.tabBar().setExpanding(True)
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tabs.resize(300, 200)
self.tabs.addTab(self.tab1, "Tab 1")
self.tabs.addTab(self.tab2, "Tab 2")
# Create first tab
self.tab1.layout = QVBoxLayout(self)
self.layout.addWidget(self.tabs)
self.setLayout(self.layout)
def resizeEvent(self, event):
super().resizeEvent(event)
self._set_tabs_width()
def showEvent(self, event):
super().showEvent(event)
self._set_tabs_width()
def _set_tabs_width(self):
tabs_count = self.tabs.count()
tabs_width = self.tabs.width()
tab_width = tabs_width / tabs_count
css = "QTabBar::tab {width: %spx;}" % tab_width
self.tabs.setStyleSheet(css)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())

Related

How do I programmatically change the parent of a layout

I want to be able to move a layout to another layout based on a user input. I have the following code which does not appear to work for me. If I switch lines 31 and 34 so that they operate on the widget rather than the layout then I get the expected behaviour but I am hoping to operate on all widgets within a layout by just moving the layout.
import sys
from PyQt5.QtWidgets import QPushButton, QWidget, QHBoxLayout, QLabel, QApplication, QVBoxLayout
class b(QWidget):
def __init__(self, name):
super(b, self).__init__()
self.layout = QVBoxLayout(self)
lbl_1 = QLabel(name)
self.layout.addWidget(lbl_1)
class a(QWidget):
def __init__(self):
super(a, self).__init__()
self.layout = QHBoxLayout(self)
self.widget_1 = b('widget 1')
self.widget_2 = b('widget 2')
self.layout.addWidget(self.widget_1)
self.layout.addWidget(self.widget_2)
self.button_layout = QHBoxLayout()
self.move_layout = QPushButton('Move to other layout')
self.move_layout.clicked.connect(lambda: self.move_button())
self.button_layout.addWidget(self.move_layout)
self.widget = 'widget_2'
self.widget_2.layout.addLayout(self.button_layout)
def move_button(self):
if self.widget == 'widget_2':
self.widget_1.layout.addLayout(self.button_layout)
self.widget = 'widget_1'
else:
self.widget_2.layout.addLayout(self.button_layout)
self.widget = 'widget_2'
print('moved widget to {}'.format(self.widget))
if __name__ == '__main__':
app = QApplication(sys.argv)
window = a()
window.show()
sys.exit(app.exec_())
Edit: to clarify, In the example above, the layout I want to move (self.button_layout) is a child layout of self.widget_2.layout. When I click the pushbutton, I want the self.button_layout to be set as a child layout of self.widget_1.layout. Essentially it will do what the code below does but using addLayout instead of addWidget.
import sys
from PyQt5.QtWidgets import QPushButton, QWidget, QHBoxLayout, QLabel, QApplication, QVBoxLayout
class b(QWidget):
def __init__(self, name):
super(b, self).__init__()
self.layout = QVBoxLayout(self)
lbl_1 = QLabel(name)
self.layout.addWidget(lbl_1)
class a(QWidget):
def __init__(self):
super(a, self).__init__()
self.layout = QHBoxLayout(self)
self.widget_1 = b('widget 1')
self.widget_2 = b('widget 2')
self.layout.addWidget(self.widget_1)
self.layout.addWidget(self.widget_2)
self.button_layout = QHBoxLayout()
self.move_layout = QPushButton('Move to other layout')
self.move_layout.clicked.connect(lambda: self.move_button())
self.button_layout.addWidget(self.move_layout)
self.widget = 'widget_2'
self.widget_2.layout.addLayout(self.button_layout)
def move_button(self):
if self.widget == 'widget_2':
self.widget_1.layout.addWidget(self.move_layout)
self.widget = 'widget_1'
else:
self.widget_2.layout.addWidget(self.move_layout)
self.widget = 'widget_2'
print('moved widget to {}'.format(self.widget))
if __name__ == '__main__':
app = QApplication(sys.argv)
window = a()
window.show()
sys.exit(app.exec_())
The problem is that if a layout has a parent then it cannot be changed as the error message indicates:
QLayout::addChildLayout: layout "" already has a parent
One possible solution is to remove the parent:
def move_button(self):
self.button_layout.setParent(None)
if self.widget == "widget_2":
self.widget_1.layout.addLayout(self.button_layout)
self.widget = "widget_1"
else:
self.widget_2.layout.addLayout(self.button_layout)
self.widget = "widget_2"
print("moved widget to {}".format(self.widget))
Another alternative is to place the layout in a QWidget that is the container and that place it in the required layout:
class a(QWidget):
def __init__(self):
super(a, self).__init__()
layout = QHBoxLayout(self)
self.widget_1 = b("widget 1")
self.widget_2 = b("widget 2")
layout.addWidget(self.widget_1)
layout.addWidget(self.widget_2)
self.container = QWidget()
container_layout = QHBoxLayout(self.container)
button = QPushButton("Move to other layout")
button.clicked.connect(self.move_button)
container_layout.addWidget(button)
self.widget = "widget_1"
self.move_button()
def move_button(self):
if self.widget == "widget_2":
self.widget_1.layout.addWidget(self.container)
self.widget = "widget_1"
else:
self.widget_2.layout.addWidget(self.container)
self.widget = "widget_2"
print("moved widget to {}".format(self.widget))

PyQt5 Add and remove tabs outside of class

I have a Python app that uses PyQt5 for it's GUI. I have a Tab Widget in it, and I want to add and remove tabs outside of window class. Something like:
Tabs.addTab("name")
How do I do that?
Here is my code:
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QAction, QTabWidget ,QVBoxLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class App(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'Test'
self.left = 0
self.top = 0
self.width = 500
self.height = 500
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.table_widget = MyTableWidget(self)
self.setCentralWidget(self.table_widget)
self.show()
class MyTableWidget(QWidget):
def __init__(self, parent):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
self.tabs = QTabWidget()
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tabs.resize(300,200)
self.tabs.addTab(self.tab1, "Tab 1")
self.tabs.addTab(self.tab2, "Tab 2")
self.layout.addWidget(self.tabs)
self.setLayout(self.layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())
Thank you for your help!
It does not matter if you are going to remove the tab within the class or outside of it but you have to use the QTabWidget object, for example in your case if you want to add a tab from the "App" class then you must do it through the object "table_widget" whose attribute is "tabs" which is the QTabWidget:
class App(QMainWindow):
def __init__(self):
super().__init__()
# ...
self.table_widget.tabs.addTab(QWidget(), "name") # <--- add tab
self.table_widget.tabs.removeTab(0) # <--- remove tab

Create a Translucent canvas for dropping files [PyQT]

Baseline
How I want to create
Hi
I have a simple PyQT5 app. The main window is a QMainWindow which houses a QWidget. The Layout of the QWidget is as follows:
Class Canvas(QWidget):
def __init__(self):
super().__init__()
self.ListOfPlots = []
self.outFile = "temp.prb"
self.initUI()
def initUI(self):
self.headLabel = QLabel("List of Plots:")
self.label = QLabel("",self)
self.setAcceptDrops(True)
self.createPushButtons()
hbox = QHBoxLayout() #Horizontal Layout
#hbox.addStretch(1)
hbox.addWidget(self.combineButton)
hbox.addWidget(self.openButton)
hbox.addWidget(self.resetButton)
self.vbox = QVBoxLayout()
self.vbox.addWidget(self.headLabel)
self.vbox.addWidget(self.label)
self.vbox.addLayout(hbox) ## The horizontal box is placed into vertical layout
self.setLayout(self.vbox)
I want to create a translucent drop area as shown in the second picture with a label indicating drop files here. What would be the most suitable way to do it?
The entire widget is ok to allow drops. I just want a box indicating it is ok to drop here (like an indicator).
You can use dynamic properties to trigger an indicator when it's okay to drop. If you need the background to be semi-transparent, use rgba for your widget's stylesheet background property. background:rgba(255,255,255,90)
from PySide2 import QtWidgets
import sys
from PySide2.QtWidgets import QWidget, QGridLayout, QFrame
class DropZone(QFrame):
def __init__(self, parent=None):
QFrame.__init__(self)
self.setFixedSize(200, 200)
self.setAcceptDrops(True)
self.setObjectName('DropZone')
self.setStyleSheet(
'QFrame#DropZone[Dropindicator=true]{border:3px solid green;background:darkorange;}\nQFrame#DropZone{background:orange;}')
def dragEnterEvent(self, event):
if event.mimeData().hasFormat('text/plain'):
self.setProperty('Dropindicator',True)
print(event.mimeData().text())
self.setStyle(self.style())
...
event.accept()
else:
event.ignore()
def dropEvent(self, event):
event.accept()
if event.isAccepted():
self.setProperty('Dropindicator',False)
self.setStyle(self.style())
class Widget( QWidget):
def __init__(self,parent=None):
QWidget.__init__(self)
gl = QGridLayout()
self.setLayout(gl)
self.dz = DropZone()
self.dz.setParent(self)
gl.addWidget(self.dz)
self.setLayout(gl)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
w = Widget()
w.show()
sys.exit(app.exec_())

Update a QLabel , using a QPushButton in a QDialog

I am just started to use the PyQt5 and I am trying to update the information of a label, through a button that is inside a subclass (QDialog). When I push the button, the program stop and show the message:
"AttributeError: 'New_Player_Window' object has no attribute 'name_window_label'
The idea is that when the Button is pressed, the Qlabel that by default is "Anonimous" become the Name of the User.
The code is:
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout,
QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QAction, QMenu,
QDialog
import sys
class General_Window(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.resize(500, 500)
self.move(300, 100)
self.setWindowTitle('Black Jack')
#MENUBAR
menubar = self.menuBar()
fileMenu = menubar.addMenu('File')
newAct = QAction('New Player', self)
newAct.triggered.connect(General_Window.new_player)
fileMenu.addAction(newAct)
#LABEL
self.name_window_label = QLabel('Anonimous', self)
self.name_window_label.move(245, 15)
self.show()
def update_window(self, value):
print(str(value))
self.name_window_label.setText(str(value))
def new_player(self):
class New_Player_Window(QDialog, General_Window):
def __init__(self):
super().__init__()
self.initUI()
def create(self):
try:
int(self.money.text()) + 2
except:
QMessageBox.question(self, 'PyQt5 message', "You need to
insert a Number", QMessageBox.Ok , QMessageBox.Ok)
else:
global value
value = self.name.text()
print(value)
self.update_window(value)
def initUI(self):
self.setGeometry(300, 230, 250, 120)
self.setWindowTitle('User Information')
#TEXTBOX1
self.name = QLineEdit(self)
self.name.move(110, 5)
self.name.resize(110,20)
#TEXTBOX2
self.money = QLineEdit(self)
self.money.move(110, 40)
self.money.resize(110,20)
#BUTTON1
self.button = QPushButton('Create', self)
self.button.move(5,80)
self.button.clicked.connect(self.create)
#BUTTON2
self.button2 = QPushButton('Cancel', self)
self.button2.move(120,80)
#LABELNAME
self.name_label = QLabel('SHORT NAME', self)
self.name_label.move(20,10)
#LABELNAME
self.money_label = QLabel('MONEY AVAILABLE', self)
self.money_label.move(10,45)
self.show()
self.exec_()
if __name__=="__main__":
New_Player_Window()
if __name__=="__main__":
app = QApplication(sys.argv)
ag = General_Window()
sys.exit(app.exec_())
You have several errors:
As you point out, General_Window has the name_window_label attribute so it would be expected that New_Player_Window would have it too, but name_window_label is created in initUI but you have overwritten it in the New_Player_Window class so that does not exist that attribute but even if it had it, it would not be the name_window_label of the other window since it is another class that has another object, I recommend reading about OOP and especially about inheritance and composition.
Having an internal class of another class is considered a bad practice (with exceptions such as django) since you are creating the class at every moment spending resources unnecessarily.
This is not an error in itself but is a bad practice, do not use global variables since debugging a global variable is complicated since it has a difficult life cycle that can hide other types of problems.
Finally consider using the appropriate widgets for the user to enter the appropriate data type, for example use QSpinBox for integer values so you avoid unnecessary checking. I also add the recommendation to the use of layouts as I will show in my answer.
Going to the design of the solution, when you create a widget consider it as a black box that receives inputs and generates outputs, if the output is synchronous it uses a method where you can retrieve that information and if it is asynchronous it uses a signal, on the other QDialog side is a class specialized in requesting information so you should not update the information in New_Player_Window but in General_Window for it you must pass the information. QDialog uses exec_() to return if the user accepts or rejects the request but for this you must call accept or reject.
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class New_Player_Window(QtWidgets.QDialog):
def __init__(self):
super().__init__()
self.initUI()
def get_values(self):
return self.name.text(), self.money.value()
def initUI(self):
self.setWindowTitle('User Information')
#TEXTBOX1
self.name = QtWidgets.QLineEdit()
#TEXTBOX2
self.money = QtWidgets.QSpinBox(maximum=2147483647)
#BUTTON1
self.button = QtWidgets.QPushButton('Create')
self.button.clicked.connect(self.accept)
#BUTTON2
self.button2 = QtWidgets.QPushButton('Cancel')
self.button2.clicked.connect(self.reject)
lay = QtWidgets.QVBoxLayout(self)
flay = QtWidgets.QFormLayout()
flay.addRow("SHORT NAME", self.name)
flay.addRow("MONEY AVAILABLE", self.money)
lay.addLayout(flay)
hlay = QtWidgets.QHBoxLayout()
hlay.addWidget(self.button)
hlay.addWidget(self.button2)
lay.addLayout(hlay)
self.setFixedSize(self.sizeHint())
class General_Window(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Black Jack')
#MENUBAR
menubar = self.menuBar()
fileMenu = menubar.addMenu('File')
newAct = QtWidgets.QAction('New Player', self)
newAct.triggered.connect(self.new_player)
fileMenu.addAction(newAct)
#LABEL
self.name_window_label = QtWidgets.QLabel('Anonimous', alignment=QtCore.Qt.AlignCenter)
widget = QtWidgets.QWidget()
self.setCentralWidget(widget)
lay = QtWidgets.QVBoxLayout(widget)
lay.addWidget(self.name_window_label, alignment=QtCore.Qt.AlignTop)
def update_window(self, value):
self.name_window_label.setText(value)
def new_player(self):
w = New_Player_Window()
if w.exec_() == QtWidgets.QDialog.Accepted:
name, value = w.get_values()
print(name, value)
self.update_window(name)
if __name__=="__main__":
app = QtWidgets.QApplication(sys.argv)
ag = General_Window()
ag.show()
sys.exit(app.exec_())
Try it:
import sys
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout,
QLineEdit, QLabel, QWidget, QPushButton,
QMessageBox, QAction, QMenu, QDialog, QSpinBox)
class General_Window(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.resize(500, 500)
self.move(300, 100)
self.setWindowTitle('Black Jack')
#MENUBAR
menubar = self.menuBar()
fileMenu = menubar.addMenu('File')
newAct = QAction('New Player', self)
newAct.triggered.connect(self.new_player)
fileMenu.addAction(newAct)
#LABEL
self.name_window_label = QLabel('Anonimous', self)
self.name_window_label.move(245, 15)
def update_window(self, value):
print(str(value))
self.name_window_label.setText(str(value))
def new_player(self):
self.newPlayerWindow = New_Player_Window(self)
class New_Player_Window(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.parent = parent
self.value = 12
self.initUI()
def create(self):
value = "{} - {}".format(self.name.text(), self.value)
print(value)
self.parent.update_window(value)
self.close()
def initUI(self):
self.setGeometry(300, 230, 250, 120)
self.setWindowTitle('User Information')
#TEXTBOX1
self.name = QLineEdit(self)
self.name.move(110, 5)
self.name.resize(110,20)
#TEXTBOX2
self.money = QSpinBox(self) #QLineEdit(self)
self.money.setRange(1, 99)
self.money.setValue(12)
self.money.valueChanged.connect(self.moneyValueChanged)
self.money.move(110, 40)
self.money.resize(110,20)
#BUTTON1
self.button = QPushButton('Create', self)
self.button.move(5,80)
self.button.clicked.connect(self.create)
#BUTTON2
self.button2 = QPushButton('Cancel', self)
self.button2.move(120,80)
#LABELNAME
self.name_label = QLabel('SHORT NAME', self)
self.name_label.move(20,10)
#LABELNAME
self.money_label = QLabel('MONEY AVAILABLE', self)
self.money_label.move(10,45)
self.exec_()
def moneyValueChanged(self, value):
self.value = value
if __name__=="__main__":
app = QApplication(sys.argv)
ag = General_Window()
ag.show()
sys.exit(app.exec_())

Widget on corner QTabBar is not in corner

I have a pushbutton to add a tab in a QTabWidget. But when I change the button's size, it's not in the corner anymore. So how can I bring it to the corner like in the first picture?
Not change size:
Change size:
Here is my code:
from PyQt4 import QtGui, QtCore
class PlaylistTable(QtGui.QWidget):
def __init__(self):
super(PlaylistTable, self).__init__()
self.playlistTable = QtGui.QTableWidget(self)
self.playlistTable.setFrameShape(QtGui.QFrame.NoFrame)
self.playlistTable.setFrameShadow(QtGui.QFrame.Sunken)
self.playlistTable.setLineWidth(0)
self.playlistTable.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.playlistTable.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.playlistTable.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.playlistTable.setShowGrid(True)
self.playlistTable.setGridStyle(QtCore.Qt.SolidLine)
self.playlistTable.setWordWrap(True)
self.playlistTable.setCornerButtonEnabled(True)
self.playlistTable.verticalHeader().setVisible(False)
class CustomTabWidget(QtGui.QTabWidget):
"""Tab Widget that that can have new tabs easily added to it."""
def __init__(self, parent=None):
super(CustomTabWidget, self).__init__(parent)
# QtGui.QTabWidget.__init__(self, parent)
# Tab Bar
self.tab = QtGui.QTabBar()
self.setTabBar(self.tab)
# Properties
self.setMovable(True)
self.setTabsClosable(True)
self.plusButton = QtGui.QPushButton("+")
self.plusButton.setFixedSize(QtCore.QSize(22, 22))
self.setCornerWidget(self.plusButton)
# Signals
self.connect(self.plusButton, QtCore.SIGNAL('clicked()'), self.addTab)
# self.tab.plusClicked.connect(self.addTab)
self.tab.tabMoved.connect(self.tab.moveTab)
self.tabCloseRequested.connect(self.removeTab)
def addTab(self):
string = QtCore.QString.fromUtf8("Playlist")
tab = PlaylistTable()
super(CustomTabWidget, self).addTab(tab, string)
class AppDemo(QtGui.QMainWindow):
def __init__(self):
super(AppDemo, self).__init__()
self.centralwidget = QtGui.QWidget(self)
self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setContentsMargins(0, -1, 0, -1)
self.playlist_manager = CustomTabWidget(self.centralwidget)
self.horizontalLayout.addWidget(self.playlist_manager)
self.playlist_manager.addTab()
self.setCentralWidget(self.centralwidget)
self.show()
# end class AppDemo
def main():
import sys
app = QtGui.QApplication(sys.argv)
w = AppDemo()
w.setWindowTitle('AppDemo')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
I'm guessing the reason is this, from QTabWidget Documentation:
The geometry of the widget is determined
based on the widget's sizeHint() and the style().
If you print the sizeHint() of the QPushButton you will see that width never goes below a certain value.
I've found an alternative is to use a QToolButton which can do everything (even more) a QPushButton does.
self.plusButton = QtGui.QToolButton(self)
self.plusButton.setText("+")

Categories