Data Shapes UI

Hi everyone! Quick question: I have been using DATA SHAPES to create interactive user interfaces for my scripts, however I would like to know if it is possible to change the .css of my files. I would love to be able to alter the buttons // text and windows layouts and colours.

Thanks so much

My understanding is that you would have to extract the Python node from the
UI.MultipleInputForm++ node, and then alter the code using The Revit API

What in particular do you want the user interface window to do differently?

Oh I see @t.large ! I would just like to create an interface that is more asthetic. For example, with pyrevit interface, all the buttons and boxes have rounded corners and colors that match the logo. I would just like to make those minor changes to make the UI more aesthetically pleasing for the user.

If I remember back to my adventures of fiddling with the UI.MultipleInputForm++ python code, I don’t remember it being easy to change the aesthetics of the window, just the funcitonality of buttons, logo, data input types.

However it must be possible, for me to have an input dropdown node that I’ve modified.

IN[0] should be a true boolean.
IN[1] should be the list of input options.

#Copyright(c) 2015, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
#Modified by @josols ,josols@hotmail.com for QRCoder
#Modernized by @t.large, largett97@gmail.com

import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System.Drawing import Point, Color, Font
from System.Windows.Forms import *
from System import Array, Object

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

class DropDownForm(Form):
	def __init__(self):
		self.Text = "Fabrication Services"
		self.TopMost = True
		self.Width = 340
		self.Height = 112
		self.BackColor = Color.FromArgb(40,40,40)
		self.ControlBox = False
		self.FormBorderStyle = FormBorderStyle.FixedDialog
		self.StartPosition = FormStartPosition.CenterScreen
		
		self.combo1 = ComboBox()
		self.combo1.Location = Point(5, 5)
		self.combo1.Width = 325
		self.combo1.BackColor = Color.FromArgb(53,53,53)
		self.combo1.ForeColor = Color.FromArgb(234,234,234)
		self.combo1.Font = Font("Calibri", 11)
		self.combo1.MouseClick += self.expand
		self.Controls.Add(self.combo1)
		
		self.button1 = Button()
		self.button1.Text = 'Select'
		self.button1.AutoSize = True
		self.button1.Width = 325
		self.button1.Location = Point(5, 42)
		self.button1.ForeColor = Color.FromArgb(234,234,234)
		self.button1.Font = Font("Calibri", 11)
		self.button1.Click += self.save
		self.Controls.Add(self.button1)
	
	def expand(self, sender, event):
		self.combo1.DroppedDown = True
	def add_range(self,l1):
		self.combo1.Items.AddRange(l1)	
		if l1.Length >= 1:
			self.combo1.SelectedIndex = 0
	def save(self, sender, event):
		self.output1 = self.combo1.SelectedItem
		self.Close()
Test = IN[1]
ArrayList = list(Test)
l1_arr = Array[Object](ArrayList)
form = DropDownForm()
form.add_range(l1_arr)
Application.Run(form)
OUT = form.output1
Application.Exit()

With the above code pasted into a Python Node, you are able to edit some of the aesthetic options of the User Interface window. However I don’t think you can adjust features such as rounded edges, unfortunately. Although I am sure there is someone with more knowledge of UI windows.

On a side note, if anyone uses this code, please let me know what you think

2 Likes

For example, with pyrevit interface

I think PyRevit uses WPF, so you could look into that.

Data-Shapes uses Windows Forms, which are easy to use, but also pretty limited in customisation.

1 Like

Pyrevit does indeed, and their youtube channel has a great introduction to wpf/xaml and how to design interfaces in visual studio, visually.

I’m slowly learning wpf currently, and all I can say is set aside a fair bit of time. It’s not easy.

1 Like

super cool stuff @t.large , I will be trying to explore thid code once I have more time and probably more experience as well! Thanks so much for sharing!

@Hamish and @GavinCrump thank you for sharing your experince, definitely something I will be trying in the future but I beleive I should gather some better basic knowledge to be well prepared for this task :sweat_smile:

1 Like